]> granicus.if.org Git - postgis/commitdiff
initialize state->num_fields and state->pgfieldtypes on shape file create otherwise...
authorRegina Obe <lr@pcorp.us>
Mon, 11 Sep 2017 01:51:41 +0000 (01:51 +0000)
committerRegina Obe <lr@pcorp.us>
Mon, 11 Sep 2017 01:51:41 +0000 (01:51 +0000)
References #3839 for PostGIS 2.4.0

git-svn-id: http://svn.osgeo.org/postgis/trunk@15678 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-core.c

index c081ef572e03a34893f19f6f14100305df1e9dfd..63f8ecb165707ac00dee31e75d5113b111789d6d 100644 (file)
@@ -784,6 +784,8 @@ ShpLoaderCreate(SHPLOADERCONFIG *config)
        state->precisions = NULL;
        state->col_names = NULL;
        state->field_names = NULL;
+       state->num_fields = NULL;
+       state->pgfieldtypes = NULL;
 
        state->from_srid = config->shp_sr_id;
        state->to_srid = config->sr_id;
@@ -1075,6 +1077,7 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
 
        /* Get the field information from the DBF */
        state->num_fields = DBFGetFieldCount(state->hDBFHandle);
+
        state->num_records = DBFGetRecordCount(state->hDBFHandle);
 
        /* Allocate storage for field information */
@@ -1864,7 +1867,6 @@ ShpLoaderDestroy(SHPLOADERSTATE *state)
 {
        /* Destroy a state object created with ShpLoaderOpenShape */
        int i;
-
        if (state != NULL)
        {
                if (state->hSHPHandle)