[Qemu-devel] [PATCH] util/error: Fix leak in error_vprepend()

Max Reitz posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170413160952.29918-1-mreitz@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
util/error.c | 1 +
1 file changed, 1 insertion(+)
[Qemu-devel] [PATCH] util/error: Fix leak in error_vprepend()
Posted by Max Reitz 7 years ago
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 util/error.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/error.c b/util/error.c
index 9c40b1f458..020b86b9f0 100644
--- a/util/error.c
+++ b/util/error.c
@@ -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);
 }
 
-- 
2.12.2


Re: [Qemu-devel] [PATCH] util/error: Fix leak in error_vprepend()
Posted by Fam Zheng 7 years ago
On Thu, 04/13 18:09, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  util/error.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/util/error.c b/util/error.c
> index 9c40b1f458..020b86b9f0 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -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);
>  }
>  
> -- 
> 2.12.2
> 
> 

Reviewed-by: Fam Zheng <famz@redhat.com>

Re: [Qemu-devel] [PATCH] util/error: Fix leak in error_vprepend()
Posted by Jeff Cody 7 years ago
On Thu, Apr 13, 2017 at 06:09:52PM +0200, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  util/error.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/util/error.c b/util/error.c
> index 9c40b1f458..020b86b9f0 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -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);
>  }
>  
> -- 
> 2.12.2
> 
>

Reviewed-by: Jeff Cody <jcody@redhat.com>