[postgis-users] Re: Segfault in shp2pgsql? Or did I mess up compiling.
Ron Mayer
rm_postgis at cheapcomplexdevices.com
Thu Apr 21 01:31:37 PDT 2005
Ron Mayer wrote:
> I just tried installing postgis1.0.0 on SuSE 9.2 and seem to be getting a
> segmentation fault with some of the shp2pgsql imports. This shapefile:
>
> http://edcftp.cr.usgs.gov/pub/data/nationalatlas/citiesx020.tar.gz
It's been too long since I've programmed in "C", but does this patch
fix it. It feels to me like calloc() needed to allocate one extra
byte for the null-termination on the string? Not sure it's the correct
fix; but it made the problem go away for me.
Ron
fli-lin1 postgis-1.0.0/loader> diff -u shp2pgsql.c shp2pgsql.c.~1~
--- shp2pgsql.c 2005-04-21 01:23:02.939225544 -0700
+++ shp2pgsql.c.~1~ 2005-04-14 05:58:59.000000000 -0700
@@ -227,7 +227,7 @@
size = ptr-str+toescape;
- result = calloc(1, size+1);
+ result = calloc(1, size);
optr=result;
ptr=str;
fli-lin1 postgis-1.0.0/loader>
More information about the postgis-users
mailing list