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

Sandro Santilli strk at kbt.io
Fri Aug 5 07:53:46 PDT 2016


Author: strk
Date: 2016-08-05 07:53:46 -0700 (Fri, 05 Aug 2016)
New Revision: 15039

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

Fixes #3608 for 2.2 branch

Patch by Matt Amos <zerebubuth at gmail.com>

Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS	2016-08-05 14:52:21 UTC (rev 15038)
+++ branches/2.2/NEWS	2016-08-05 14:53:46 UTC (rev 15039)
@@ -16,6 +16,7 @@
   			in tiger extension, postgis_sfcgal, address_standardizer  
   - #3607, Fix inconsistency with multilinestring in
            ST_LocateBetweenElevations (Artur Zakirov)
+  - #3608, Fix crash passing -W UTF-8 to shp2pgsql (Matt Amos)
 
 
 PostGIS 2.2.2

Modified: branches/2.2/loader/shp2pgsql-cli.c
===================================================================
--- branches/2.2/loader/shp2pgsql-cli.c	2016-08-05 14:52:21 UTC (rev 15038)
+++ branches/2.2/loader/shp2pgsql-cli.c	2016-08-05 14:53:46 UTC (rev 15039)
@@ -169,7 +169,7 @@
 			break;
 
 		case 'W':
-			config->encoding = pgis_optarg;
+			config->encoding = strdup(pgis_optarg);
 			break;
 
 		case 'N':



More information about the postgis-tickets mailing list