Skip to contentSkip to conversation

util/error: Fix leak in error_vprepend()

PATCH Applied Max Reitz 4 participants 4 messages Apr 13, 2017 – Apr 20, 2017

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 util/error: Fix leak in error_vprepend()

---
 util/error.c | 1 +
 1 file changed, 1 insertion(+)
util/error.c +1 -0
index 9c40b1f458..020b86b9f0 100644
@@ -134,6 +134,7 @@ void error_vprepend(Error **errp, const char *fmt, va_list ap)
     newmsg = g_string_new(NULL);
     g_string_vprintf(newmsg, fmt, ap);
     g_string_append(newmsg, (*errp)->msg);
+    g_free((*errp)->msg);
     (*errp)->msg = g_string_free(newmsg, 0);
 }
 
Signature · 1 line
2.12.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Max Reitz
---
 util/error.c | 1 +
 1 file changed, 1 insertion(+)
util/error.c +1 -0
index 9c40b1f458..020b86b9f0 100644
@@ -134,6 +134,7 @@ void error_vprepend(Error **errp, const char *fmt, va_list ap)
     newmsg = g_string_new(NULL);
     g_string_vprintf(newmsg, fmt, ap);
     g_string_append(newmsg, (*errp)->msg);
+    g_free((*errp)->msg);
     (*errp)->msg = g_string_free(newmsg, 0);
 }
 
Signature · 1 line
2.12.2
Reviewed-by on v1 1/1
#2 lore raw
In reply to Max Reitz
Quoted 21 lines · Max Reitz
---
 util/error.c | 1 +
 1 file changed, 1 insertion(+)
util/error.c +1 -0
index 9c40b1f458..020b86b9f0 100644
@@ -134,6 +134,7 @@ void error_vprepend(Error **errp, const char *fmt, va_list ap)
     newmsg = g_string_new(NULL);
     g_string_vprintf(newmsg, fmt, ap);
     g_string_append(newmsg, (*errp)->msg);
+    g_free((*errp)->msg);
     (*errp)->msg = g_string_free(newmsg, 0);
 }
 
Signature · 1 line
2.12.2
#3 lore raw
In reply to Max Reitz
Quoted 10 lines · Max Reitz
---
 util/error.c | 1 +
 1 file changed, 1 insertion(+)
util/error.c +0 -0
index 9c40b1f458..020b86b9f0 100644

util/error.c void error_vprepend(Error **errp, const char *fmt, va_list ap) · line 139

Quoted 6 lines
util/error.c +1 -0
@@ -134,6 +134,7 @@ void error_vprepend(Error **errp, const char *fmt, va_list ap)
     newmsg = g_string_new(NULL);
     g_string_vprintf(newmsg, fmt, ap);
     g_string_append(newmsg, (*errp)->msg);
+    g_free((*errp)->msg);
     (*errp)->msg = g_string_free(newmsg, 0);
 }

Applied to error-next, thanks!