[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

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

2011-06-08 Thread Øyvind Harboe
Looks OK to me. Any objections? -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International +47 51 87 40 27 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer __

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

2011-06-08 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 g

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

2011-06-08 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 woul

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

2011-06-08 Thread Øyvind Harboe
On Thu, Jun 9, 2011 at 8:37 AM, Peter Stuge 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 supposed

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

2011-06-08 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 wrote: > > 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 actually used, the a