[postgis-tickets] r15040 - Allocate memory for encoding argument, so it can be safely freed later.

Sandro Santilli strk at kbt.io
Fri Aug 5 07:55:45 PDT 2016


Author: strk
Date: 2016-08-05 07:55:45 -0700 (Fri, 05 Aug 2016)
New Revision: 15040

Modified:
   branches/2.1/NEWS
   branches/2.1/loader/shp2pgsql-cli.c
Log:
Allocate memory for encoding argument, so it can be safely freed later.

Fixes #3608 for 2.1 branch

Patch by Matt Amos <zerebubuth at gmail.com>

Modified: branches/2.1/NEWS
===================================================================
--- branches/2.1/NEWS	2016-08-05 14:53:46 UTC (rev 15039)
+++ branches/2.1/NEWS	2016-08-05 14:55:45 UTC (rev 15040)
@@ -32,6 +32,7 @@
   - #3583, Crash in ST_GeomFromGeoJSON on malformed multipolygon
   - #3607, Fix inconsistency with multilinestring in
            ST_LocateBetweenElevations (Artur Zakirov)
+  - #3608, Fix crash passing -W UTF-8 to shp2pgsql (Matt Amos)
 
 
 PostGIS 2.1.8

Modified: branches/2.1/loader/shp2pgsql-cli.c
===================================================================
--- branches/2.1/loader/shp2pgsql-cli.c	2016-08-05 14:53:46 UTC (rev 15039)
+++ branches/2.1/loader/shp2pgsql-cli.c	2016-08-05 14:55:45 UTC (rev 15040)
@@ -160,7 +160,7 @@
 			break;
 
 		case 'W':
-			config->encoding = pgis_optarg;
+			config->encoding = strdup(pgis_optarg);
 			break;
 
 		case 'N':



More information about the postgis-tickets mailing list