In case of OOM when constructing an array, we should abandon the
container to free the resources.
Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit
3f070088232f82fafce97c4fb3015da098fe00bf)
if (!dbus_message_iter_append_fixed_array (&array,
element_type,
value,
- n_elements))
+ n_elements)) {
+ dbus_message_iter_abandon_container (&iter, &array);
goto failed;
+ }
}
else if (element_type == DBUS_TYPE_STRING ||
element_type == DBUS_TYPE_SIGNATURE ||
{
if (!dbus_message_iter_append_basic (&array,
element_type,
- &value[i]))
+ &value[i])) {
+ dbus_message_iter_abandon_container (&iter, &array);
goto failed;
+ }
++i;
}
}