Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Laurent Gauch
Free the buffer before return. Also check the malloc return value. Perhaps it's not a good idea to exit() on error, but it's in line with the rest of the function. Strange thing with this function is that the allocated buffer doesn't seem to be used for anything. The data read into it doesn't

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Peter Stuge
Andreas Fritiofson wrote: Strange thing with this function is that the allocated buffer doesn't seem to be used for anything. The data read into it doesn't go anywhere. Maybe the entire function is flawed, or is the data really supposed to be discarded? If noone can answer this then I would

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Øyvind Harboe
On Thu, Jun 9, 2011 at 8:37 AM, Peter Stuge pe...@stuge.se wrote: Andreas Fritiofson wrote: Strange thing with this function is that the allocated buffer doesn't seem to be used for anything. The data read into it doesn't go anywhere. Maybe the entire function is flawed, or is the data really

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Øyvind Harboe
Definitely! I'm holding off on this patch in favor of a patch that deletes cruft instead of decorating it :-) I have a soft spot for patches that delete code that nobody understands -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Andreas Fritiofson
On Thu, Jun 9, 2011 at 8:40 AM, Øyvind Harboe oyvind.har...@zylin.comwrote: Definitely! I'm holding off on this patch in favor of a patch that deletes cruft instead of decorating it :-) I have a soft spot for patches that delete code that nobody understands IF the function is

[Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-08 Thread Andreas Fritiofson
Free the buffer before return. Also check the malloc return value. Perhaps it's not a good idea to exit() on error, but it's in line with the rest of the function. Strange thing with this function is that the allocated buffer doesn't seem to be used for anything. The data read into it doesn't go