From b8fc690fa5464d018ffce842d73f3f31f8eb8cda Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 8 Feb 2012 20:51:49 +0000 Subject: [PATCH] do not heap-allocate SPI arg types git-svn-id: http://svn.osgeo.org/postgis/trunk@9113 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rt_pg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c index 9eaead56f..782d5a884 100644 --- a/raster/rt_pg/rt_pg.c +++ b/raster/rt_pg/rt_pg.c @@ -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." -- 2.40.0