diff options
author | Daniel Mack <github@zonque.org> | 2015-09-09 09:57:29 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-09-09 09:57:29 +0200 |
commit | 0fa7d1f5be847d4804eb3bf6a4c10333ea14e0bc (patch) | |
tree | 6afb70cc560bd94219f81495ff699c83b404e18c /src/core/service.c | |
parent | bed2c013b6570908a114a337632000cf9c9de838 (diff) | |
parent | ece174c5439021e32ebcc858842de9586072c006 (diff) |
Merge pull request #1207 from poettering/coccinelle-fixes
Coccinelle fixes
Diffstat (limited to 'src/core/service.c')
-rw-r--r-- | src/core/service.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/core/service.c b/src/core/service.c index 292fe50de8..e396dbe213 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -142,8 +142,7 @@ static void service_unwatch_pid_file(Service *s) { log_unit_debug(UNIT(s), "Stopping watch for PID file %s", s->pid_file_pathspec->path); path_spec_unwatch(s->pid_file_pathspec); path_spec_done(s->pid_file_pathspec); - free(s->pid_file_pathspec); - s->pid_file_pathspec = NULL; + s->pid_file_pathspec = mfree(s->pid_file_pathspec); } static int service_set_main_pid(Service *s, pid_t pid) { @@ -287,14 +286,9 @@ static void service_done(Unit *u) { assert(s); - free(s->pid_file); - s->pid_file = NULL; - - free(s->status_text); - s->status_text = NULL; - - free(s->reboot_arg); - s->reboot_arg = NULL; + s->pid_file = mfree(s->pid_file); + s->status_text = mfree(s->status_text); + s->reboot_arg = mfree(s->reboot_arg); s->exec_runtime = exec_runtime_unref(s->exec_runtime); exec_command_free_array(s->exec_command, _SERVICE_EXEC_COMMAND_MAX); @@ -313,8 +307,7 @@ static void service_done(Unit *u) { if (s->bus_name) { unit_unwatch_bus_name(u, s->bus_name); - free(s->bus_name); - s->bus_name = NULL; + s->bus_name = mfree(s->bus_name); } s->bus_endpoint_fd = safe_close(s->bus_endpoint_fd); @@ -702,13 +695,12 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) { fprintf(f, "%sStatus Text: %s\n", prefix, s->status_text); - if (s->n_fd_store_max > 0) { + if (s->n_fd_store_max > 0) fprintf(f, "%sFile Descriptor Store Max: %u\n" "%sFile Descriptor Store Current: %u\n", prefix, s->n_fd_store_max, prefix, s->n_fd_store); - } } static int service_load_pid_file(Service *s, bool may_warn) { @@ -1939,8 +1931,7 @@ static int service_start(Unit *u) { s->forbid_restart = false; s->reset_cpu_usage = true; - free(s->status_text); - s->status_text = NULL; + s->status_text = mfree(s->status_text); s->status_errno = 0; s->notify_state = NOTIFY_UNKNOWN; |