diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-01-17 11:45:47 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-02-16 14:47:08 +0000 |
commit | fbecc334356510c333e2742cead8600296f618dc (patch) | |
tree | 705293c15a91d5cc5dc9c8804ae9bb28cd7690d3 /bus | |
parent | 65f61236d77505b4ad5ad5f998e4062b21cf2efd (diff) |
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
Diffstat (limited to 'bus')
-rw-r--r-- | bus/activation.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bus/activation.c b/bus/activation.c index 00d4be60..f69bf202 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))) { |