From: Jorge Arévalo Date: Thu, 7 Apr 2011 18:02:25 +0000 (+0000) Subject: Some memory freed. Related ticket #851. X-Git-Tag: 2.0.0alpha1~1794 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3955185051b69bec0dbf8e227d7c4aaab4c0993f;p=postgis Some memory freed. Related ticket #851. git-svn-id: http://svn.osgeo.org/postgis/trunk@7008 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c index 9030a075e..7e41b58b4 100644 --- a/raster/rt_pg/rt_pg.c +++ b/raster/rt_pg/rt_pg.c @@ -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(); }