diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2015-08-02 19:32:21 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2015-08-02 19:32:21 +0200 |
commit | 13fd31ccc6d9ff8084a312effbb9add9aeaec010 (patch) | |
tree | 9523cb0bce8b7a00569333cd407ed16cb39aaf5a | |
parent | f429182e629ff2ba019ad74af0a63bf938b5d511 (diff) | |
parent | ba243e5155fd824dcd5235992e691017bd328b3f (diff) |
Merge pull request #834 from namhyung/sdbus-cleanup-v2
sd-bus: Small cleanups (v2)
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 767df40e81..0f075907d5 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -73,13 +73,9 @@ static void bus_close_fds(sd_bus *b) { detach_io_events(b); - if (b->input_fd >= 0) - safe_close(b->input_fd); - - if (b->output_fd >= 0 && b->output_fd != b->input_fd) + if (b->input_fd != b->output_fd) safe_close(b->output_fd); - - b->input_fd = b->output_fd = -1; + b->output_fd = b->input_fd = safe_close(b->input_fd); } static void bus_reset_queues(sd_bus *b) { @@ -88,15 +84,13 @@ static void bus_reset_queues(sd_bus *b) { while (b->rqueue_size > 0) sd_bus_message_unref(b->rqueue[--b->rqueue_size]); - free(b->rqueue); - b->rqueue = NULL; + b->rqueue = mfree(b->rqueue); b->rqueue_allocated = 0; while (b->wqueue_size > 0) sd_bus_message_unref(b->wqueue[--b->wqueue_size]); - free(b->wqueue); - b->wqueue = NULL; + b->wqueue = mfree(b->wqueue); b->wqueue_allocated = 0; } @@ -908,15 +902,11 @@ static void bus_reset_parsed_address(sd_bus *b) { zero(b->sockaddr); b->sockaddr_size = 0; - strv_free(b->exec_argv); - free(b->exec_path); - b->exec_path = NULL; - b->exec_argv = NULL; + b->exec_argv = strv_free(b->exec_argv); + b->exec_path = mfree(b->exec_path); b->server_id = SD_ID128_NULL; - free(b->kernel); - b->kernel = NULL; - free(b->machine); - b->machine = NULL; + b->kernel = mfree(b->kernel); + b->machine = mfree(b->machine); b->nspid = 0; } |