Commit b4cb853e authored by Ralf Habacker's avatar Ralf Habacker

Fix memory leak in _dbus_win_set_error_from_win_error().

There is no 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=92721Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 52e97d76
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment