]> granicus.if.org Git - postgis/commitdiff
Fix deallocation of terminating NULL in RASTER_asGDALRaster (#1432)
authorSandro Santilli <strk@keybit.net>
Wed, 4 Jan 2012 22:30:21 +0000 (22:30 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 4 Jan 2012 22:30:21 +0000 (22:30 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8674 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_pg/rt_pg.c

index cd20cb3d415645966c4ce5a523d3e56ab3a909b3..78fb52a73e440fa6a45bdd44dd2da77569c4d1c2 100644 (file)
@@ -6596,11 +6596,12 @@ Datum RASTER_asGDALRaster(PG_FUNCTION_ARGS)
                        }
 
                        if (j > 0) {
+                               /* trim allocation */
+                               options = repalloc(options, (j+1) * sizeof(char *));
+
                                /* add NULL to end */
                                options[j] = NULL;
 
-                               /* trim allocation */
-                               options = repalloc(options, j * sizeof(char *));
                        }
                        else {
                                pfree(options);