[CRIU] [PATCH v2 02/13] restore: Simplify do_fork_with_pid() #2

Kirill Tkhai ktkhai at virtuozzo.com
Tue May 16 09:25:58 PDT 2017


Move xfree() up

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-restore.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index a31d1c7f0..51738896b 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1292,12 +1292,12 @@ static int do_fork_with_pid(struct pstree_item *item, struct ns_id *pid_ns, stru
 		if (hlp_pid->ns[i].virt < 0)
 			hlp_pid->ns[i].virt = INIT_PID + 1;
 	}
-	if (set_next_pid(pid_ns->parent, hlp_pid) < 0) {
+	ret = set_next_pid(pid_ns->parent, hlp_pid);
+	xfree(hlp_pid);
+	if (ret) {
 		pr_err("Can't set next pid\n");
-		xfree(hlp_pid);
 		return -1;
 	}
-	xfree(hlp_pid);
 
 	if (ca->clone_flags & CLONE_FILES)
 		close_pid_proc();



More information about the CRIU mailing list