diff options
author | Simon McVittie <smcv@collabora.com> | 2017-11-27 19:13:25 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2022-10-05 10:46:55 +0100 |
commit | 82fcf400cc2d6a5f4247528dd5c27b26e867675a (patch) | |
tree | 72dbddfd49c74964e115855ed2d9edfde44df873 | |
parent | 9f675abd3fea8222011b1134714c3cf71f7b1f2b (diff) |
dbus_message_demarshal: Set error if we can't allocate the loader
Backported from 1.13.0. Previously this was fixed in the dbus-1.14 branch
but unfixed in the dbus-1.12 branch, but we need it fixed in dbus-1.12
if we want the additional test coverage for dbus#413 to pass.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit ecbcffae19ff1b811fc7d0d602458c0f00dd6771)
-rw-r--r-- | dbus/dbus-message.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 84d8c0ca..34b56f15 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -5093,7 +5093,7 @@ dbus_message_demarshal (const char *str, int len, DBusError *error) { - DBusMessageLoader *loader; + DBusMessageLoader *loader = NULL; DBusString *buffer; DBusMessage *msg; @@ -5102,7 +5102,7 @@ dbus_message_demarshal (const char *str, loader = _dbus_message_loader_new (); if (loader == NULL) - return NULL; + goto fail_oom; _dbus_message_loader_get_buffer (loader, &buffer, NULL, NULL); @@ -5133,7 +5133,10 @@ dbus_message_demarshal (const char *str, fail_oom: _DBUS_SET_OOM (error); - _dbus_message_loader_unref (loader); + + if (loader != NULL) + _dbus_message_loader_unref (loader); + return NULL; } |