[Liblas-commits] laszip: don't leak writers_raw and writers_compressed pointers w...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Jan 12 15:38:47 EST 2011


details:   http://hg.liblas.orglaszip/rev/d5c0b464915e
changeset: 138:d5c0b464915e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed Jan 12 14:38:41 2011 -0600
description:
don't leak writers_raw and writers_compressed pointers when cleaning up

diffstat:

 src/laswritepoint.cpp |  76 ++++++++++++++++++++++++++------------------------
 1 files changed, 39 insertions(+), 37 deletions(-)

diffs (130 lines):

diff -r 53f5dbd25856 -r d5c0b464915e src/laswritepoint.cpp
--- a/src/laswritepoint.cpp	Wed Jan 12 09:23:39 2011 -0800
+++ b/src/laswritepoint.cpp	Wed Jan 12 14:38:41 2011 -0600
@@ -16,40 +16,40 @@
  *
  ****************************************************************************/
 
-/*
-===============================================================================
-
-  FILE:  laswritepoint.cpp
-  
-  CONTENTS:
-  
-    see corresponding header file
-  
-  PROGRAMMERS:
-  
-    martin isenburg at cs.unc.edu
-  
-  COPYRIGHT:
-  
-    copyright (C) 2007-10  martin isenburg at cs.unc.edu
-    
-    This software is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  
-  CHANGE HISTORY:
-  
-    see corresponding header file
-  
-===============================================================================
-*/
-
-#include "laswritepoint.hpp"
+/*
+===============================================================================
+
+  FILE:  laswritepoint.cpp
+  
+  CONTENTS:
+  
+    see corresponding header file
+  
+  PROGRAMMERS:
+  
+    martin isenburg at cs.unc.edu
+  
+  COPYRIGHT:
+  
+    copyright (C) 2007-10  martin isenburg at cs.unc.edu
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  
+  CHANGE HISTORY:
+  
+    see corresponding header file
+  
+===============================================================================
+*/
+
+#include "laswritepoint.hpp"
 
 #include "arithmeticencoder.hpp"
-#ifdef LASZIP_HAVE_RANGECODER
+#ifdef LASZIP_HAVE_RANGECODER
 #include "rangeencoder.hpp"
-#endif
+#endif
 #include "laswriteitemraw.hpp"
 #include "laswriteitemcompressed_v1.hpp"
 
@@ -81,11 +81,11 @@
   case LASzip::POINT_BY_POINT_RAW:
     enc = 0;
     break;
-#ifdef LASZIP_HAVE_RANGECODER
+#ifdef LASZIP_HAVE_RANGECODER
   case LASzip::POINT_BY_POINT_RANGE:
     enc = new RangeEncoder();
     break;
-#endif
+#endif
   case LASzip::POINT_BY_POINT_ARITHMETIC:
     enc = new ArithmeticEncoder();
     break;
@@ -222,7 +222,7 @@
   }
   return TRUE;
 }
-
+
 BOOL LASwritePoint::done()
 {
   if (enc)
@@ -232,16 +232,17 @@
   return TRUE;
 }
 
-LASwritePoint::~LASwritePoint()
+LASwritePoint::~LASwritePoint()
 {
   U32 i;
 
   if (writers_raw)
-  {
+  {
     for (i = 0; i < num_writers; i++)
     {
       delete writers_raw[i];
     }
+    delete writers_raw;
   }
   if (writers_compressed)
   {
@@ -249,9 +250,10 @@
     {
       delete writers_compressed[i];
     }
+    delete writers_compressed;
   }
   if (enc)
   {
     delete enc;
   }
-}
+}


More information about the Liblas-commits mailing list