[CRIU] [PATCH] restore: sigreturn_restore: free core _after_ using it

Ruslan Kuprieiev kupruser at gmail.com
Wed Jul 30 15:00:07 PDT 2014


Currently we have this:
	.......
	/* No longer need it */
	core_entry__free_unpacked(core, NULL);

	ret = prepare_itimers(pid, core, task_args);
	if (ret < 0)
		goto err;
	.......

So we're using ptr right after free-ing it.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 cr-restore.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 556a35e..f3c6ccb 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -2645,9 +2645,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 
 	new_sp = restorer_stack(task_args->t);
 
-	/* No longer need it */
-	core_entry__free_unpacked(core, NULL);
-
 	ret = prepare_itimers(pid, core, task_args);
 	if (ret < 0)
 		goto err;
@@ -2660,6 +2657,9 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 	if (ret < 0)
 		goto err;
 
+	/* No longer need it */
+	core_entry__free_unpacked(core, NULL);
+
 	/*
 	 * Open the last_pid syscl early, since restorer (maybe) lives
 	 * in chroot and has no access to "/proc/..." paths.
-- 
1.9.1



More information about the CRIU mailing list