]> granicus.if.org Git - postgis/commitdiff
Fix memory management error, array of pointers allocated insufficient space.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 4 Feb 2003 22:57:44 +0000 (22:57 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 4 Feb 2003 22:57:44 +0000 (22:57 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@237 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql.c

index da0dfe0b4e56fce640b9e149d4321dc68fe597f7..de2d3db4021c84ce758258068bf3f857556cffb6 100644 (file)
@@ -4,6 +4,9 @@
  * Author: Jeff Lounsbury, jeffloun@refractions.net
  *
  * $Log$
+ * Revision 1.29  2003/02/04 22:57:44  pramsey
+ * Fix memory management error, array of pointers allocated insufficient space.
+ *
  * Revision 1.28  2003/02/04 21:39:20  pramsey
  * Added CVS substitution strings for logging.
  *
@@ -552,7 +555,7 @@ int main (int ARGC, char **ARGV){
 
                num_fields = DBFGetFieldCount( hDBFHandle );
                num_records = DBFGetRecordCount(hDBFHandle);
-               names = malloc(num_fields +1);
+               names = malloc((num_fields + 1)*sizeof(char*));
                for(j=0;j<num_fields;j++){
                        type = DBFGetFieldInfo(hDBFHandle, j, name, NULL, NULL); 
                        names[j] = malloc ( strlen(name)+1);