[glib] gdbusmessage: Fix a minor memory leak on an error path
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gdbusmessage: Fix a minor memory leak on an error path
- Date: Tue, 21 Apr 2015 23:03:43 +0000 (UTC)
commit bc01109618009ad748abdc58bdc0c64891b84db0
Author: Philip Withnall <philip tecnocode co uk>
Date: Tue Apr 21 23:57:17 2015 +0100
gdbusmessage: Fix a minor memory leak on an error path
If g_dbus_message_to_blob() fails at all, it will leak its mbuf. Spotted
by running the gdbus-serialization test under Valgrind — so there is a
justification for leak-free tests after all!
gio/gdbusmessage.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index 766609e..d9d8f37 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -2745,6 +2745,9 @@ g_dbus_message_to_blob (GDBusMessage *message,
ret = (guchar *)mbuf.data;
out:
+ if (ret == NULL)
+ g_free (mbuf.data);
+
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]