From 080193b19561104d5023128e80e47a0cfc38a623 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 17 Jan 2011 11:45:47 +0000 Subject: [PATCH 5/7] 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 files changed, 11 insertions(+), 0 deletions(-) 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))) { -- 1.7.2.3