X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fexecute.c;h=1ea646334bce13edac6fb57567bc7a828fd77937;hp=78fb81f7262771d97002512bb3e5ea964bfa0c67;hb=e1d758033dc7e101ab32323a0f1649d8daf56a22;hpb=6ec60d20724d2a32e20d25ef75d2af178c242bc2;ds=sidebyside diff --git a/src/core/execute.c b/src/core/execute.c index 78fb81f72..1ea646334 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) {