Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: core/src/fxcodec/jbig2/JBig2_List.h

Issue 1400663003: Merge to XFA: Fix a malloc/delete mismatch introduced in commit 8a9ce57. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_GsidProc.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/jbig2/JBig2_List.h
diff --git a/core/src/fxcodec/jbig2/JBig2_List.h b/core/src/fxcodec/jbig2/JBig2_List.h
index ffdd22c3ca7bc0659ca2983fc235eae0d3f25fe1..6097294e177d640642098e27506cc9b85c111d17 100644
--- a/core/src/fxcodec/jbig2/JBig2_List.h
+++ b/core/src/fxcodec/jbig2/JBig2_List.h
@@ -15,6 +15,7 @@ template <class TYPE>
class CJBig2_List {
public:
CJBig2_List() {}
+ explicit CJBig2_List(size_t count) { resize(count); }
~CJBig2_List() {
clear();
@@ -34,6 +35,12 @@ class CJBig2_List {
// Takes ownership of |pItem|.
void push_back(TYPE* pItem) { m_vector.push_back(pItem); }
+ // Takes ownership of |pItem|.
+ void set(size_t index, TYPE* pItem) {
+ delete m_vector[index];
+ m_vector[index] = pItem;
+ }
+
void resize(size_t count) {
for (size_t i = count; i < size(); ++i)
delete m_vector[i];
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_GsidProc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698