diff options
author | Ronny Chevalier <chevalier.ronny@gmail.com> | 2014-06-24 19:00:32 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-06-24 19:09:57 +0200 |
commit | e1d758033dc7e101ab32323a0f1649d8daf56a22 (patch) | |
tree | a1688425a3c125569b34dc0e28318361245b2bc8 /src/core/execute.c | |
parent | 6ec60d20724d2a32e20d25ef75d2af178c242bc2 (diff) |
use more _cleanup_ macro
Diffstat (limited to 'src/core/execute.c')
-rw-r--r-- | src/core/execute.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 78fb81f726..1ea646334b 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -561,7 +561,7 @@ static int restore_confirm_stdio(int *saved_stdin, static int ask_for_confirmation(char *response, char **argv) { int saved_stdout = -1, saved_stdin = -1, r; - char *line; + _cleanup_free_ char *line = NULL; r = setup_confirm_stdio(&saved_stdin, &saved_stdout); if (r < 0) @@ -572,7 +572,6 @@ static int ask_for_confirmation(char *response, char **argv) { return -ENOMEM; r = ask(response, "yns", "Execute %s? [Yes, No, Skip] ", line); - free(line); restore_confirm_stdio(&saved_stdin, &saved_stdout); @@ -2058,8 +2057,8 @@ int exec_context_load_environment(const ExecContext *c, char ***l) { } static bool tty_may_match_dev_console(const char *tty) { - char *active = NULL, *console; - bool b; + _cleanup_free_ char *active = NULL; + char *console; if (startswith(tty, "/dev/")) tty += 5; @@ -2074,10 +2073,7 @@ static bool tty_may_match_dev_console(const char *tty) { return true; /* "tty0" means the active VC, so it may be the same sometimes */ - b = streq(console, tty) || (streq(console, "tty0") && tty_is_vc(tty)); - free(active); - - return b; + return streq(console, tty) || (streq(console, "tty0") && tty_is_vc(tty)); } bool exec_context_may_touch_console(ExecContext *ec) { @@ -2467,10 +2463,10 @@ char *exec_command_line(char **argv) { } void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) { - char *p2; + _cleanup_free_ char *p2 = NULL; const char *prefix2; - char *cmd; + _cleanup_free_ char *cmd = NULL; assert(c); assert(f); @@ -2486,11 +2482,7 @@ void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) { "%sCommand Line: %s\n", prefix, cmd ? cmd : strerror(ENOMEM)); - free(cmd); - exec_status_dump(&c->exec_status, f, prefix2); - - free(p2); } void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix) { |