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 <[email protected]>
---
 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
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to