summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/jbig2/JBig2_List.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-08 15:55:15 -0700
committerLei Zhang <thestig@chromium.org>2015-10-08 15:55:15 -0700
commita51027d660e30da1ceaa7a025257725341649ffb (patch)
tree05ac057239b1eb07490c6dcceab9334f97a6d4a8 /core/src/fxcodec/jbig2/JBig2_List.h
parent921cc2403a9e643dfb29d70564fa435a1d79f972 (diff)
downloadpdfium-a51027d660e30da1ceaa7a025257725341649ffb.tar.xz
Merge to XFA: Fix a malloc/delete mismatch introduced in commit 8a9ce57.
Just get rid of the malloc altogether and use CJBig2_List instead. BUG=540873 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1394933002 . (cherry picked from commit 06f255ca4040f3d73cf09f1dbd63a3b167f6a4c1) Review URL: https://codereview.chromium.org/1400663003 .
Diffstat (limited to 'core/src/fxcodec/jbig2/JBig2_List.h')
-rw-r--r--core/src/fxcodec/jbig2/JBig2_List.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_List.h b/core/src/fxcodec/jbig2/JBig2_List.h
index ffdd22c3ca..6097294e17 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];