[mapserver-dev] Checks in msFreeCharArray

Daniel Morissette dmorissette at mapgears.com
Wed Apr 8 07:34:17 PDT 2015

On 2015-04-08 10:19 AM, martin.kofahl at gmail.com wrote:
> Hello,
> I tamper with some cases, where ‎msFreeCharArray is called, but the array was already freed, although num_items is still >0. (The join code.) I would prefer msFreeCharArray checks if array still exisist and sets it to null instead of doing this in the caller functions.
> Would this be ok?

Doing this would require changing the signature of the function to pass 
it a ref to the char array pointer (so that it can be set to NULL), 
which would not feel very natural as most free methods everywhere else 
always receive the pointer value, not a ref to it, and it is always up 
to the caller to properly managing the pointer (setting to NULL or other 

I'm open to hearing more arguments in favor of this approach, but at 
this point I'd be -0 on this change.

Daniel Morissette
T: +1 418-696-5056 #201
Provider of Professional MapServer Support since 2000

More information about the mapserver-dev mailing list