[mapserver-dev] Checks in msFreeCharArray

Lime, Steve D (MNIT) Steve.Lime at state.mn.us
Wed Apr 8 10:45:01 PDT 2015

I agree with Dan on this one...

-----Original Message-----
From: mapserver-dev-bounces at lists.osgeo.org [mailto:mapserver-dev-bounces at lists.osgeo.org] On Behalf Of Daniel Morissette
Sent: Wednesday, April 08, 2015 9:34 AM
To: mapserver-dev at lists.osgeo.org
Subject: Re: [mapserver-dev] Checks in msFreeCharArray

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 method).

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 _______________________________________________
mapserver-dev mailing list
mapserver-dev at lists.osgeo.org

More information about the mapserver-dev mailing list