From 7fe12a51e00717d5de66e5a8020849864db22940 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Tue, 10 Jan 2012 18:18:23 +0000 Subject: [PATCH] Fixed double free of memory when using out-of-database bands git-svn-id: http://svn.osgeo.org/postgis/trunk@8750 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/loader/raster2pgsql.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/raster/loader/raster2pgsql.c b/raster/loader/raster2pgsql.c index 223cfe8b4..3954b423e 100644 --- a/raster/loader/raster2pgsql.c +++ b/raster/loader/raster2pgsql.c @@ -46,8 +46,10 @@ raster_destroy(rt_raster raster) { uint16_t nbands = rt_raster_get_num_bands(raster); for (i = 0; i < nbands; i++) { rt_band band = rt_raster_get_band(raster, i); - void *mem = rt_band_get_data(band); - if (mem) free(mem); + if (!rt_band_is_offline(band)) { + void* mem = rt_band_get_data(band); + if (mem) rtdealloc(mem); + } rt_band_destroy(band); } rt_raster_destroy(raster); -- 2.50.1