]> granicus.if.org Git - postgis/commitdiff
do not heap-allocate SPI arg types
authorSandro Santilli <strk@keybit.net>
Wed, 8 Feb 2012 20:51:49 +0000 (20:51 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 8 Feb 2012 20:51:49 +0000 (20:51 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9113 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_pg/rt_pg.c

index 9eaead56f35a6c87770df341945a80b9c0aaa78d..782d5a8846d4183c3fa137085f3218628a1262df 100644 (file)
@@ -2577,7 +2577,7 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS)
     char *argkw[] = {"[rast]", "[rast.x]", "[rast.y]"};
     Oid argkwtypes[] = { FLOAT8OID, INT4OID, INT4OID };
     int argcount = 0;
-    Oid *argtype = 0;
+    Oid argtype[] = { FLOAT8OID, INT4OID, INT4OID };
     uint8_t argpos[3] = {0};
     char place[5];
     int idx = 0;
@@ -3012,7 +3012,6 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS)
         newexpr = rtpg_strreplace(initexpr, "[rast.val]", "[rast]", NULL);
         pfree(initexpr); initexpr=newexpr;
 
-        argtype = (Oid*)palloc(sizeof(Oid)*3);
         sprintf(place,"$1");
         for (i = 0, j = 1; i < argkwcount; i++) {
             len = 0;
@@ -3048,7 +3047,6 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS)
 
         /* Type of all arguments is FLOAT8OID */
         spi_plan = SPI_prepare(initexpr, argcount, argtype);
-        /* pfree(argtype); safe here ? */
 
         if (spi_plan == NULL) {
             elog(ERROR, "RASTER_mapAlgebraExpr: Could not prepare expression."