From d3c709be960c4845cd7f5a8e0566022fd881da6d Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 11 Nov 2015 14:30:27 +0100 Subject: [PATCH] Fix memory leak in _dbus_win_set_error_from_win_error(). There is not need to make a local (leaked) copy of the message, because dbus_set_error() already makes a copy of its parameters. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721 --- dbus/dbus-sysdeps-win.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index e626cc6..61da703 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -3610,13 +3610,8 @@ _dbus_win_set_error_from_win_error (DBusError *error, (LPSTR) &msg, 0, NULL); if (msg) { - char *msg_copy; - - msg_copy = dbus_malloc (strlen (msg)); - strcpy (msg_copy, msg); + dbus_set_error (error, "win32.error", "%s", msg); LocalFree (msg); - - dbus_set_error (error, "win32.error", "%s", msg_copy); } else dbus_set_error (error, "win32.error", "Unknown error code %d or FormatMessage failed", code); -- 1.8.4.5