From 9831b25b7b4c6e00bb52f0a606b9c073e32e7a5b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 27 Nov 2017 19:13:25 +0000 Subject: [PATCH 03/10] dbus_message_demarshal: Set error if we can't allocate the loader Signed-off-by: Simon McVittie --- dbus/dbus-message.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 0d985a82..66a39747 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -5086,7 +5086,7 @@ dbus_message_demarshal (const char *str, int len, DBusError *error) { - DBusMessageLoader *loader; + DBusMessageLoader *loader = NULL; DBusString *buffer; DBusMessage *msg; @@ -5095,7 +5095,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); @@ -5126,7 +5126,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; } -- 2.15.1