[PATCH] coverity#983009: Resource leak

Julien Nabet (via Code Review) gerrit at gerrit.libreoffice.org
Mon Mar 4 12:20:35 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2550

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/50/2550/1

coverity#983009: Resource leak

Just moving pArr block should be ok

Change-Id: I9c5c4c35b90d8f06933521c77c966a426a801cec
---
M hwpfilter/source/hwpread.cxx
1 file changed, 4 insertions(+), 4 deletions(-)



diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index 325f74c..becdb76 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -310,6 +310,10 @@
     hwpf.ReadParaList(caption);
 
      if( type == 0 ){ // if table?
+          TCell* *pArr = ::comphelper::newArray_null<TCell *>(ncell);
+          if (!pArr) {
+                return hwpf.SetState(HWP_InvalidFileFormat);
+          }
           Table *tbl = new Table;
           for( ii = 0 ; ii < ncell; ii++)
           {
@@ -317,10 +321,6 @@
                 tbl->columns.insert(cell[ii].x + cell[ii].w);
                 tbl->rows.insert(cell[ii].y);
                 tbl->rows.insert(cell[ii].y + cell[ii].h);
-          }
-          TCell* *pArr = ::comphelper::newArray_null<TCell *>(ncell);
-          if (!pArr) {
-                return hwpf.SetState(HWP_InvalidFileFormat);
           }
           for( ii = 0 ; ii < ncell; ii++)
           {

-- 
To view, visit https://gerrit.libreoffice.org/2550
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c5c4c35b90d8f06933521c77c966a426a801cec
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Julien Nabet <serval2412 at yahoo.fr>



More information about the LibreOffice mailing list