util/error: Fix leak in error_vprepend()

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20170413160952.29918-1-mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Max Reitz 2017-04-13 18:09:52 +02:00 committed by Markus Armbruster
parent 32c7e0ab75
commit 536eeea869

View File

@ -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);
}