[QGIS Commit] r14178 - trunk/qgis/src/core/pal

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Sep 2 04:11:45 EDT 2010


Author: mhugent
Date: 2010-09-02 08:11:45 +0000 (Thu, 02 Sep 2010)
New Revision: 14178

Modified:
   trunk/qgis/src/core/pal/feature.cpp
Log:
Fix another memory leak

Modified: trunk/qgis/src/core/pal/feature.cpp
===================================================================
--- trunk/qgis/src/core/pal/feature.cpp	2010-09-01 21:46:44 UTC (rev 14177)
+++ trunk/qgis/src/core/pal/feature.cpp	2010-09-02 08:11:45 UTC (rev 14178)
@@ -654,7 +654,6 @@
 
     if ( index <= 1 && distance < 0 ) // We've gone off the start, fail out
     {
-      std::cerr << "err1" << std::endl;
       return NULL;
     }
 
@@ -666,7 +665,6 @@
     }
     if ( index >= path_positions->nbPoints )
     {
-      std::cerr << "err2" << std::endl;
       return NULL;
     }
 
@@ -688,7 +686,6 @@
     if ( segment_length == 0 )
     {
       // Not allowed to place across on 0 length segments or discontinuities
-      std::cerr << "err3" << std::endl;
       return NULL;
     }
 
@@ -714,7 +711,7 @@
       if ( segment_length == 0 )
       {
         // Not allowed to place across on 0 length segments or discontinuities
-        std::cerr << "err4" << std::endl;
+        delete slp;
         return NULL;
       }
 
@@ -743,7 +740,7 @@
           index++;
           if ( index >= path_positions->nbPoints ) // Bail out if we run off the end of the shape
           {
-            //std::cerr << "err5" << std::endl;
+            delete slp;
             return NULL;
           }
           new_x = path_positions->x[index];
@@ -777,7 +774,7 @@
       while ( angle_delta < -M_PI ) angle_delta += 2 * M_PI;
       if ( f->labelInfo->max_char_angle_delta > 0 && fabs( angle_delta ) > f->labelInfo->max_char_angle_delta*( M_PI / 180 ) )
       {
-        std::cerr << "err6" << std::endl;
+        delete slp;
         return NULL;
       }
 
@@ -826,12 +823,14 @@
       if ( !orientation_forced )
       {
         orientation = -orientation;
+        delete slp;
+        slp = NULL;
         slp = curvedPlacementAtOffset( path_positions, path_distances, orientation, initial_index, initial_distance );
       }
       else
       {
         // Otherwise we have failed to find a placement
-        //std::cerr << "err7" << std::endl;
+        delete slp;
         return NULL;
       }
     }



More information about the QGIS-commit mailing list