[Crosstoolchain-logs] [device-tree-compiler] 22/58: livetree.c: Fix memory leak
Vagrant Cascadian
vagrant at moszumanska.debian.org
Mon Sep 25 16:23:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
vagrant pushed a commit to branch debian/master
in repository device-tree-compiler.
commit 95d57726bca42fdedf63178a46a15599c02b60cc
Author: Jean-Christophe Dubois <jcd at tribudubois.net>
Date: Tue Feb 7 22:26:25 2017 +0100
livetree.c: Fix memory leak
When running coverity on dtc source code the following error is reported.
==========================================================================
*** CID 1370967: Resource leaks (RESOURCE_LEAK)
/tools/dtc/livetree.c: 850 in add_fixup_entry()
844 if (strchr(node->fullpath, ':') || strchr(prop->name, ':'))
845 die("arguments should not contain ':'\n");
846
847 xasprintf(&entry, "%s:%s:%u",
848 node->fullpath, prop->name, m->offset);
849 append_to_property(fn, m->ref, entry, strlen(entry) + 1);
>>> CID 1370967: Resource leaks (RESOURCE_LEAK)
>>> Variable "entry" going out of scope leaks the storage it points to.
850 }
==========================================================================
Fix the leak.
Signed-off-by: Jean-Christophe Dubois <jcd at tribudubois.net>
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
livetree.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/livetree.c b/livetree.c
index afa2f67..994b6c2 100644
--- a/livetree.c
+++ b/livetree.c
@@ -847,6 +847,8 @@ static void add_fixup_entry(struct dt_info *dti, struct node *fn,
xasprintf(&entry, "%s:%s:%u",
node->fullpath, prop->name, m->offset);
append_to_property(fn, m->ref, entry, strlen(entry) + 1);
+
+ free(entry);
}
static void generate_fixups_tree_internal(struct dt_info *dti,
--
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