[Crosstoolchain-logs] [device-tree-compiler] 110/198: Fix memory leak in srcpos_verror()

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.4.x
in repository device-tree-compiler.

commit 0c0bf8519aab878acb864d84185bd2395b1e3d5b
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Wed Jan 1 23:23:54 2014 +1100

    Fix memory leak in srcpos_verror()
    
    Since dtc runs are short, we don't care that much about memory leaks.
    Still, leaking the source position string every time we print an error
    messages is pretty nasty.  Fix it.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 srcpos.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/srcpos.c b/srcpos.c
index 48059aa..6705fed 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -293,13 +293,15 @@ srcpos_string(struct srcpos *pos)
 void
 srcpos_verror(struct srcpos *pos, const char *fmt, va_list va)
 {
-	const char *srcstr;
+	char *srcstr;
 
 	srcstr = srcpos_string(pos);
 
 	fprintf(stderr, "Error: %s ", srcstr);
 	vfprintf(stderr, fmt, va);
 	fprintf(stderr, "\n");
+
+	free(srcstr);
 }
 
 void

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list