dbus: Fix some memory leaks on error paths

wpa_dbus_dict_close_write() was not called if
fill_dict_with_properties() fails and that could result in leaking
memory. Fix this in two cases. There might be other missing calls to
jouni@codeaurora.org() on error paths, but those will need to be handled
separately with more complex changes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-05-08 22:06:46 +03:00 committed by Jouni Malinen
parent e3b39e62c2
commit a96c783645

View file

@ -98,6 +98,7 @@ static DBusMessage * get_all_properties(DBusMessage *message, char *interface,
dbus_error_init(&error);
if (!fill_dict_with_properties(&dict_iter, obj_dsc->properties,
interface, obj_dsc->user_data, &error)) {
wpa_dbus_dict_close_write(&iter, &dict_iter);
dbus_message_unref(reply);
reply = wpas_dbus_reply_new_from_error(
message, &error, DBUS_ERROR_INVALID_ARGS,
@ -930,6 +931,7 @@ dbus_bool_t wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
dbus_error_is_set(&error) ? error.name : "none",
dbus_error_is_set(&error) ? error.message : "none");
dbus_error_free(&error);
wpa_dbus_dict_close_write(iter, &dict_iter);
return FALSE;
}