Index: head/databases/pgsphere/Makefile =================================================================== --- head/databases/pgsphere/Makefile (revision 548446) +++ head/databases/pgsphere/Makefile (revision 548447) @@ -1,39 +1,39 @@ # Created by: Sunpoet Po-Chuan Hsieh # $FreeBSD$ PORTNAME= pgsphere PORTVERSION= 1.1.5 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= databases geography MAINTAINER= sunpoet@FreeBSD.org COMMENT= Spherical data types, functions, and operators for PostgreSQL LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/COPYRIGHT.pg_sphere OPTIONS_DEFINE= DOCS USES= gmake pgsql LLD_UNSAFE= yes USE_LDCONFIG= yes MAKE_ARGS= PG_CONFIG=${LOCALBASE}/bin/pg_config USE_PGXS=1 \ docdir=${DOCSDIR} \ install_bin=/usr/bin/install TEST_TARGET= installcheck DATADIR= ${PREFIX}/share/postgresql DOCSDIR?= ${PREFIX}/share/doc/postgresql GH_TAGNAME= e0b303d USE_GITHUB= yes DOCS_MAKE_ARGS_OFF= DOCS="" post-patch: @${REINPLACE_CMD} -e 's|int4|int32|g' ${WRKSRC}/line.c ${WRKSRC}/line.h post-install: ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/postgresql/pg_sphere.so .include Index: head/databases/pgsphere/files/patch-path.c =================================================================== --- head/databases/pgsphere/files/patch-path.c (nonexistent) +++ head/databases/pgsphere/files/patch-path.c (revision 548447) @@ -0,0 +1,25 @@ +--- path.c.orig 2019-10-30 10:18:38 UTC ++++ path.c +@@ -513,13 +513,21 @@ spherepath_in(PG_FUNCTION_ARGS) + nelem = get_path_count(); + if (nelem > 1) + { +- SPoint arr[nelem]; ++ SPoint* arr = (SPoint*)malloc(nelem*sizeof(SPoint)); ++ if (arr == NULL) { ++ reset_buffer(); ++ elog(ERROR, "spherepath_in: could not allocate array"); ++ PG_RETURN_NULL(); ++ } + + for (i = 0; i < nelem; i++) + { + get_path_elem(i, &arr[i].lng, &arr[i].lat); + } + path = spherepath_from_array(&arr[0], nelem); ++ ++ //free array ++ free(arr); + } + else + { Property changes on: head/databases/pgsphere/files/patch-path.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/databases/pgsphere/files/patch-polygon.c =================================================================== --- head/databases/pgsphere/files/patch-polygon.c (nonexistent) +++ head/databases/pgsphere/files/patch-polygon.c (revision 548447) @@ -0,0 +1,54 @@ +--- polygon.c.orig 2019-10-30 10:18:38 UTC ++++ polygon.c +@@ -824,13 +824,21 @@ spherepoly_in(PG_FUNCTION_ARGS) + nelem = get_path_count(); + if (nelem > 2) + { +- SPoint arr[nelem]; ++ // allocate arr ++ SPoint* arr = (SPoint *)malloc(nelem * sizeof(SPoint)); ++ if (arr == NULL) { ++ reset_buffer(); ++ elog(ERROR, "spherepoly_in: Could not allocate array."); ++ PG_RETURN_NULL(); ++ } + + for (i = 0; i < nelem; i++) + { + get_path_elem(i, &arr[i].lng, &arr[i].lat); + } + poly = spherepoly_from_array(&arr[0], nelem); ++ // free allocated array ++ free(arr); + } + else + { +@@ -892,11 +900,17 @@ spherepoly_area(PG_FUNCTION_ARGS) + { + SPOLY *poly = PG_GETARG_SPOLY(0); + int32 i; +- SPoint s[poly->npts + 2]; ++ SPoint *s = (SPoint*)malloc((poly->npts+2)*sizeof(SPoint)); ++ //SPoint s[poly->npts + 2]; + SPoint stmp[2]; + SEuler se; + float8 sum = 0.0; + ++ if (s == NULL) { ++ elog(ERROR, "spherepoly_area: Could not allocate array."); ++ PG_RETURN_NULL(); ++ } ++ + memcpy((void *) &s[1], + (void *) &poly->p[0], + poly->npts * sizeof(SPoint)); +@@ -935,6 +949,9 @@ spherepoly_area(PG_FUNCTION_ARGS) + { + sum = 0.0; + } ++ ++ // free array ++ free(s); + + PG_RETURN_FLOAT8(sum); + } Property changes on: head/databases/pgsphere/files/patch-polygon.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property