Found by scan-build. Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> --- policycoreutils/run_init/run_init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c index 1c5eb68e..545490a2 100644 --- a/policycoreutils/run_init/run_init.c +++ b/policycoreutils/run_init/run_init.c @@ -406,14 +406,19 @@ int main(int argc, char *argv[]) if (chdir("/")) { perror("chdir"); + free(new_context); exit(-1); } if (setexeccon(new_context) < 0) { fprintf(stderr, _("Could not set exec context to %s.\n"), new_context); + free(new_context); exit(-1); } + + free(new_context); + if (access("/usr/sbin/open_init_pty", X_OK) != 0) { if (execvp(argv[1], argv + 1)) { perror("execvp"); -- 2.32.0