This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFA] bucomm.c (make_tempname): Stop memory leak.
- From: Michael Snyder <msnyder at vmware dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 08 Mar 2011 14:56:58 -0800
- Subject: [RFA] bucomm.c (make_tempname): Stop memory leak.
OK?
2011-03-08 Michael Snyder <msnyder@vmware.com>
* bucomm.c (make_tempname): Stop memory leak.
Index: bucomm.c
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.c,v
retrieving revision 1.42
diff -u -p -r1.42 bucomm.c
--- bucomm.c 6 Jan 2011 11:34:28 -0000 1.42
+++ bucomm.c 8 Mar 2011 22:55:10 -0000
@@ -511,7 +511,10 @@ make_tempname (char *filename)
fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
#endif
if (fd == -1)
- return NULL;
+ {
+ free (tmpname);
+ return NULL;
+ }
close (fd);
return tmpname;
}