Joaquim,<br><br>I understand that printing the contents of pszSrcWKT gave different results before and after the call to GDALClose( hSrcDS ).<br>There seems to be some code you left in the mail. Can you paste the neighbouring code at <a href="http://pastebin.ca">http://pastebin.ca</a> ?<br>
<br><div class="gmail_quote">On Sat, Jan 23, 2010 at 8:34 PM, <span dir="ltr"><<a href="mailto:jluis@ualg.pt">jluis@ualg.pt</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I have a serious crash in one of my Matlab MEXs caused by a call to OGRFree() with an argument of size one (possibly the null terminator).<br>
This happens on OSX SL (64 bits) but not on Windows (where I still build at 32 bits)<br>
<br>
Here is, as far as I could trace it, what is happening (SVN version of the same age as GDAL1.7RC1)<br>
<br>
mexPrintf("---- %s\n%s\n", pszSrcWKT,pszDstWKT);<br>
<br>
That prints<br>
<br>
---- GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]<br>
PROJCS["UTM Zone 29, Northern Hemisphere",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-9],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]<br>
<br>
<br>
Next the code does:<br>
<br>
GDALClose( hSrcDS );<br>
mexPrintf("---- %s\n%s\n", pszSrcWKT,pszDstWKT);<br>
<br>
and now pszSrcWKT is empty. See<br>
<br>
---- PROJCS["UTM Zone 29, Northern Hemisphere",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-9],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]<br>
<br>
If I make it print the size of pszSrcWKT with strlen(pszSrcWKT) the answer is 1 and finally the MEX (and the entire MATLAB) crash on the call<br>
<br>
OGRFree(pszSrcWKT);<br>
<br>
<br>
Joaquim Luis<br>
<br>
----------------------------------------------------------------<br>
This message was sent using IMP, the Internet Messaging Program.<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9848167848<br>17.241582N 80.142635E<br>