<br><font size=2 face="sans-serif">Thanks, Frank</font>
<br>
<br><font size=2 face="sans-serif">I thought this might be the problem as I've encountered uninitialized pointers with non-null values before. &nbsp;</font>
<br>
<br><font size=2 face="sans-serif">Should I file an enhancement via bugzilla for sorthshp.c to add a call to msFreeShape ? &nbsp;I'm sorry but I'm not sure of correct protocol here.</font>
<br>
<br><font size=2 face="sans-serif">And this is at the top of the post as it's difficult to bottom post using our Lotus Notes system...</font>
<br>
<br><font size=2 face="sans-serif">Cheers</font>
<br>
<br><font size=2 face="sans-serif">Richard</font>
<br>
<br><font size=2 face="sans-serif">Dr. R. E. Roger &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NSW Department of <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Primary Industries<br>
Spatial Information Officer Systems &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 161 Kite St<br>
Resource Information Unit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Locked Bag 21<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ORANGE NSW 2800<br>
ph: (02) 6391 3697 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fax: (02) 6391 3740</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Frank Warmerdam &lt;fwarmerdam@gmail.com&gt;</b></font>
<p><font size=1 face="sans-serif">12/07/2005 12:45 AM</font>
<br><font size=1 face="sans-serif">Please respond to warmerdam</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; &nbsp; &nbsp;richard.roger@agric.nsw.gov.au</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; &nbsp;MAPSERVER-DEV@lists.umn.edu</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;Re: [UMN_MAPSERVER-DEV] msSHPReadShape and potential memory leak (and sorthshp.c)</font></table>
<br>
<br>
<br><font size=2 face="Courier New">On 7/10/05, Richard Roger &lt;richard.roger@agric.nsw.gov.au&gt; wrote:<br>
<br>
&gt; This memory &quot;leak&quot; in the first loop is caused by my initially poor<br>
&gt; understanding and use of msSHPReadShape, but I think it's a mistake others<br>
&gt; might easily make. &nbsp;I think this &quot;feature&quot; could be avoided by the following<br>
&gt; change : <br>
&gt; &nbsp;<br>
&gt; *** replace the call to &quot;msInitShape&quot; in &quot;msSHPReadShape&quot; by a call to a<br>
&gt; &quot;msFreeShape&quot;. <br>
&gt; &nbsp;<br>
&gt; I am not sure if &quot;msFreeShape&quot; would need to be modified to deal with an<br>
&gt; entirely null shape. <br>
<br>
Richard, <br>
<br>
The problem is that msSHPReadShape() is typically used with shapeObj's<br>
allocated on the stack, but these are not initialized to any dependable<br>
value. &nbsp;So msSHPReadShape() has no way of telling if the shapeObj<br>
fields have pointers that need to be freed, or are just unitialized<br>
values pointing into hyperspace. <br>
<br>
So, I don't really think there is much we can practically do to change<br>
things ... we just need to be careful.<br>
<br>
Best regards,<br>
-- <br>
---------------------------------------+--------------------------------------<br>
I set the clouds in motion - turn up &nbsp; | Frank Warmerdam, warmerdam@pobox.com<br>
light and sound - activate the windows | http://pobox.com/~warmerdam<br>
and watch the world go round - Rush &nbsp; &nbsp;| Geospatial Programmer for Rent<br>
<br>
</font>
<br>
<br><font size=2 face="sans-serif"><br>
<br>
This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient or received it in error, please delete the message and notify sender. Views expressed are those of the individual sender and are not necessarily the views of their organisation.</font>