Skip to content

Commit 1644fb0

Browse files
committed
container: fix error leak
print the current error and release it. Closes: containers#1957 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent 617e653 commit 1644fb0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcrun/container.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,10 @@ do_hooks (runtime_spec_schema_config_schema *def, pid_t pid, const char *id, boo
808808
if (hooks[i]->env)
809809
env = hooks[i]->env;
810810

811+
/* Release the error from the previous iteration, if any. */
812+
if (err && *err)
813+
crun_error_release (err);
814+
811815
ret = run_process_with_stdin_timeout_envp (hooks[i]->path, hooks[i]->args, cwd, hooks[i]->timeout, env,
812816
stdin, stdin_len, out_fd, err_fd, err);
813817
if (UNLIKELY (ret != 0))

0 commit comments

Comments
 (0)