summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2014-01-01 23:23:54 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2014-01-01 23:23:54 +1100
commit0c0bf8519aab878acb864d84185bd2395b1e3d5b (patch)
treedeac7046b7bd0e9da520f5408671169fe2d605b4
parente19d3b1d6da33b78dec83a9064a1e9a570657dd6 (diff)
downloaddevice-tree-compiler-0c0bf8519aab878acb864d84185bd2395b1e3d5b.tar.gz
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@gibson.dropbear.id.au>
-rw-r--r--srcpos.c4
1 files changed, 3 insertions, 1 deletions
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