summaryrefslogtreecommitdiff
path: root/databases/pgsphere/files/patch-path.c
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2020-09-13 03:19:20 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2020-09-13 03:19:20 +0000
commit238d925aae9c19070fe5982b9e12e6d62336b86e (patch)
tree0ca142f676c396e6a43aa328c91594f978a1ea64 /databases/pgsphere/files/patch-path.c
parentgraphics/oidn: Update 1.1.0 -> 1.2.3 (diff)
databases/pgsphere: stop using VLAs to fix PG12 compilation
PR: 248657 Reported by: vvd@unislabs.com Obtained from: https://github.com/akorotkov/pgsphere/pull/14 Sponsored by: BBOX.io
Notes
Notes: svn path=/head/; revision=548447
Diffstat (limited to 'databases/pgsphere/files/patch-path.c')
-rw-r--r--databases/pgsphere/files/patch-path.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/databases/pgsphere/files/patch-path.c b/databases/pgsphere/files/patch-path.c
new file mode 100644
index 000000000000..c4f4e14171c8
--- /dev/null
+++ b/databases/pgsphere/files/patch-path.c
@@ -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
+ {