From fbecc334356510c333e2742cead8600296f618dc Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 17 Jan 2011 11:45:47 +0000 Subject: [PATCH] update_desktop_file_entry: don't double-free strings if added to entry before failure Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126 --- bus/activation.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bus/activation.c b/bus/activation.c index 00d4be6..f69bf20 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -389,6 +389,11 @@ update_desktop_file_entry (BusActivation *activation, entry->systemd_service = systemd_service; entry->refcount = 1; + /* ownership has been transferred to entry, do not free separately */ + name = NULL; + exec = NULL; + user = NULL; + systemd_service = NULL; entry->s_dir = s_dir; entry->filename = _dbus_strdup (_dbus_string_get_const_data (filename)); if (!entry->filename) @@ -433,6 +438,12 @@ update_desktop_file_entry (BusActivation *activation, entry->name = name; entry->exec = exec; entry->user = user; + /* ownership has been transferred to entry, do not free separately */ + name = NULL; + exec = NULL; + user = NULL; + systemd_service = NULL; + if (!_dbus_hash_table_insert_string (activation->entries, entry->name, bus_activation_entry_ref(entry))) { -- 2.7.4