From 075aebc8f976d718dba4094a92fd0b791b1bbc85 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 4 Jul 2017 13:33:30 +0100 Subject: [PATCH] _dbus_message_iter_open_signature: Clarify why this is not leaky The same assertion appears closer to the top of the function, and there is no opportunity for it to have become false here. Signed-off-by: Simon McVittie Reviewed-by: Philip Withnall Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101568 --- dbus/dbus-message.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 6d9dd55..f66ac1a 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -2538,6 +2538,9 @@ _dbus_message_iter_open_signature (DBusMessageRealIter *real) real->sig_refcount = 1; + /* If this assertion failed, then str would be neither stored in u.writer + * nor freed by this function, resulting in a memory leak. */ + _dbus_assert (real->u.writer.type_str == NULL); _dbus_type_writer_add_types (&real->u.writer, str, _dbus_string_get_length (str)); return TRUE; -- 2.7.4