]> granicus.if.org Git - postgis/commitdiff
Some memory freed. Related ticket #851.
authorJorge Arévalo <jorge.arevalo at deimos-space.com>
Thu, 7 Apr 2011 18:02:25 +0000 (18:02 +0000)
committerJorge Arévalo <jorge.arevalo at deimos-space.com>
Thu, 7 Apr 2011 18:02:25 +0000 (18:02 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7008 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_pg/rt_pg.c

index 9030a075e40851961067cf20a3f107d2c40f14b4..7e41b58b4c06569cb2054e09b3138d07973fe2a1 100644 (file)
@@ -1663,9 +1663,14 @@ Datum RASTER_getPixelValue(PG_FUNCTION_ARGS)
     
     /* If the result is -1 or the value is nodata and we take nodata into account then return nodata = NULL */
     if (result == -1 || (hasnodata && rt_band_get_hasnodata_flag(ctx, band) && pixvalue == rt_band_get_nodata(ctx, band))) {
+        rt_raster_destroy(ctx, raster);
+        rt_context_destroy(ctx);        
         PG_RETURN_NULL();
     }
 
+    rt_raster_destroy(ctx, raster);
+    rt_context_destroy(ctx);        
+
     PG_RETURN_FLOAT8(pixvalue);
 }
 
@@ -2073,6 +2078,8 @@ Datum RASTER_mapAlgebra(PG_FUNCTION_ARGS)
 
     if ( ! newrast ) {
         elog(ERROR, "RASTER_mapAlgebra: Could not create a new raster");
+        rt_raster_destroy(ctx, raster);
+        rt_context_destroy(ctx);
         PG_RETURN_NULL();
     }