[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 5/6] qga: Fix a memory leak
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 5/6] qga: Fix a memory leak |
Date: |
Thu, 27 Feb 2020 17:31:00 +0100 |
The string returned by g_win32_error_message() has to be
deallocated with g_free().
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
qga/channel-win32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qga/channel-win32.c b/qga/channel-win32.c
index c86f4388db..774205e017 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;
}
--
2.21.1
- [PATCH v2 0/6] misc: Improve error reporting on Windows, Philippe Mathieu-Daudé, 2020/02/27
- [PATCH v2 1/6] chardev: Improve error report by calling error_setg_win32(), Philippe Mathieu-Daudé, 2020/02/27
- [PATCH v2 2/6] util: Replace fprintf(stderr, "*\n" with error_report(), Philippe Mathieu-Daudé, 2020/02/27
- [PATCH v2 3/6] util/oslib-win32: Improve error report by calling error_setg_win32(), Philippe Mathieu-Daudé, 2020/02/27
- [PATCH v2 5/6] qga: Fix a memory leak,
Philippe Mathieu-Daudé <=
- [PATCH v2 4/6] util/osdep: Improve error report by calling error_setg_win32(), Philippe Mathieu-Daudé, 2020/02/27
- [PATCH v2 6/6] qga: Improve error report by calling error_setg_win32(), Philippe Mathieu-Daudé, 2020/02/27