|
@@ -54,7 +54,7 @@ char *GPJ_grass_to_wkt(struct Key_Value *proj_info,
|
|
|
int esri_style, int prettify)
|
|
|
{
|
|
|
OGRSpatialReferenceH hSRS;
|
|
|
- char *wkt;
|
|
|
+ char *wkt, *local_wkt;
|
|
|
|
|
|
hSRS = GPJ_grass_to_osr(proj_info, proj_units);
|
|
|
|
|
@@ -69,8 +69,10 @@ char *GPJ_grass_to_wkt(struct Key_Value *proj_info,
|
|
|
else
|
|
|
OSRExportToWkt(hSRS, &wkt);
|
|
|
|
|
|
+ local_wkt = G_store(wkt);
|
|
|
+ CPLFree(wkt);
|
|
|
OSRDestroySpatialReference(hSRS);
|
|
|
- return wkt;
|
|
|
+ return local_wkt;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -317,7 +319,11 @@ int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
temp_projinfo = G_create_key_value();
|
|
|
|
|
|
- pszRemaining = pszProj4;
|
|
|
+ /* Create "local" copy of proj4 string so we can modify and free it
|
|
|
+ * using GRASS functions */
|
|
|
+ pszRemaining = G_store(pszProj4);
|
|
|
+ CPLFree(pszProj4);
|
|
|
+ pszProj4 = pszRemaining;
|
|
|
while ((pszRemaining = strstr(pszRemaining, "+")) != NULL) {
|
|
|
char *pszToken, *pszValue;
|
|
|
|
|
@@ -567,7 +573,7 @@ int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
|
|
|
G_free_key_value(temp_projinfo);
|
|
|
}
|
|
|
|
|
|
- free(pszProj4); /* hopefully the same as CPLFree()! */
|
|
|
+ G_free(pszProj4);
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
/* Set the linear units. */
|
|
@@ -789,8 +795,8 @@ static void DatumNameMassage(char **ppszDatum)
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
for (i = 0; papszDatumEquiv[i] != NULL; i += 2) {
|
|
|
if (EQUAL(*ppszDatum, papszDatumEquiv[i])) {
|
|
|
- CPLFree(*ppszDatum);
|
|
|
- *ppszDatum = CPLStrdup(papszDatumEquiv[i + 1]);
|
|
|
+ G_free(*ppszDatum);
|
|
|
+ *ppszDatum = G_store(papszDatumEquiv[i + 1]);
|
|
|
break;
|
|
|
}
|
|
|
}
|