summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-28 11:07:26 +0100
committerMarkus Armbruster <armbru@redhat.com>2020-03-09 13:36:15 +0100
commitd1eddab86f92e7e060c8a473695c7f24ec00c9ab (patch)
treef08fb49f3fa9b277f042274b19e5493660689c5c
parent672db77892d367f1dc3797571511acce27597a11 (diff)
downloadfocaccia-qemu-d1eddab86f92e7e060c8a473695c7f24ec00c9ab.tar.gz
focaccia-qemu-d1eddab86f92e7e060c8a473695c7f24ec00c9ab.zip
qga: Fix a memory leak
The string returned by g_win32_error_message() has to be
deallocated with g_free().

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200228100726.8414-5-philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r--qga/channel-win32.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qga/channel-win32.c b/qga/channel-win32.c
index 99648c95b6..4f04868a76 100644
--- a/qga/channel-win32.c
+++ b/qga/channel-win32.c
@@ -302,8 +302,8 @@ static gboolean ga_channel_open(GAChannel *c, GAChannelMethod method,
                            OPEN_EXISTING,
                            FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, NULL);
     if (c->handle == INVALID_HANDLE_VALUE) {
-        g_critical("error opening path %s: %s", newpath,
-                   g_win32_error_message(GetLastError()));
+        g_autofree gchar *emsg = g_win32_error_message(GetLastError());
+        g_critical("error opening path %s: %s", newpath, emsg);
         return false;
     }