]> git.ipfire.org Git - thirdparty/dbus.git/commit
dbus_message_iter_get_signature: Fix two memory leaks on OOM
authorBarnabás Pőcze <pobrn@protonmail.com>
Sat, 22 Apr 2023 19:37:59 +0000 (21:37 +0200)
committerSimon McVittie <smcv@collabora.com>
Fri, 12 May 2023 18:16:47 +0000 (18:16 +0000)
commitb5a87e214fa5cb5728bc145cedcedaa6d82bd493
tree025f4a00162838a6bfcb4c224d73e5a8db93d936
parenta841b8ec8f43691c07313de6d1f27f6cbd82b1ca
dbus_message_iter_get_signature: Fix two memory leaks on OOM

Previously,  `retstr` would not be freed when `_dbus_string_append_len()`
or `_dbus_string_steal_data()` failed.

Fix those by:
 * jumping to `_dbus_string_free()` when `_dbus_string_append_len()` fails
 * ignoring the return value of `_dbus_string_free()`.

The latter works because in case of failure, `ret` will be set
to NULL by `_dbus_string_steal_data()`.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
dbus/dbus-message.c