This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Potential memory leak in argz_replace.c


I'm new to this list, so allow me to introduce myself. I am Dave Stacey, and I maintain a handful of packages for Cygwin. I also run a regular scan of the Cygwin source code using the Coverity Scan static analysis tool. I'd like to report a few warnings that Coverity reports in Cygwin's use of newlib. I'll start with one that's fairly simple; once I've learnt how you like these reporting then I'll try to send more.

The first is a theoretical (albeit unlikely) memory leak in argz_replace.c that occurs in the event that a realloc(3) fails. The attached patch should address this, and a ChangeLog entry is below. The change is rather trivial.

I'm aware that you need to support a great many compilers and platforms, and so I will completely understand if you would prefer to keep the code as it is. Hopefully the patch is in keeping with the style of the surrounding code, but if you would like anything altered then let me know and I will do my best to oblige.

Regards,

Dave Stacey.

newlib/ChangeLog
2015-05-10  David Stacey  <drstacey@tiscali.co.uk>

    * libc/argz/argz_replace.c: Fix potential memory leak.


Attachment: CID109855.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]