diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-27 02:28:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-27 22:02:12 +0100 |
commit | 50c4521675e94ade38b8af9e3b0f7fd2f300b6f4 (patch) | |
tree | 30e2586117fa037cc4dabffa934c612319bf1708 /src/libsystemd/sd-bus/bus-creds.c | |
parent | 7fa934b0d35492b300b79848f4822ffc40eee21f (diff) |
sd-bus: optimize how we generate the well-known-names lists in messages from kdbus
Diffstat (limited to 'src/libsystemd/sd-bus/bus-creds.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-creds.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c index 8aa53362fb..ad0e2e1ba7 100644 --- a/src/libsystemd/sd-bus/bus-creds.c +++ b/src/libsystemd/sd-bus/bus-creds.c @@ -51,8 +51,14 @@ void bus_creds_done(sd_bus_creds *c) { free(c->slice); free(c->unescaped_description); + free(c->well_known_names); /* note that this is an strv, but + * we only free the array, not the + * strings the array points to. The + * full strv we only free if + * c->allocated is set, see + * below. */ + strv_free(c->cmdline_array); - strv_free(c->well_known_names); } _public_ sd_bus_creds *sd_bus_creds_ref(sd_bus_creds *c) { @@ -83,8 +89,6 @@ _public_ sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c) { c->n_ref--; if (c->n_ref == 0) { - bus_creds_done(c); - free(c->comm); free(c->tid_comm); free(c->exe); @@ -96,6 +100,12 @@ _public_ sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c) { free(c->cgroup_root); free(c->description); free(c->supplementary_gids); + + strv_free(c->well_known_names); + c->well_known_names = NULL; + + bus_creds_done(c); + free(c); } } else { |