This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] binutils/windres.c: Fix memory leak issue for xmalloc and free 'n'
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 13 Nov 2014 22:23:28 +0800
- Subject: [PATCH] binutils/windres.c: Fix memory leak issue for xmalloc and free 'n'
- Authentication-results: sourceware.org; auth=none
After xmalloc 'n', if fopen() fails, need free 'n', or will cause memory
leak.
2014-11-13 Chen Gang <gang.chen.5i5j@gmail.com>
* binutiles/windres.c (open_file_search): Fix memory leak issue
for xmalloc and free 'n'.
---
binutils/windres.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/binutils/windres.c b/binutils/windres.c
index 7fa90fc..10aa722 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -204,6 +204,7 @@ open_file_search (const char *filename, const char *mode, const char *errmsg,
*real_filename = n;
return e;
}
+ free(n);
if (errno != ENOENT)
break;
--
1.9.3