[03/14] restore: Simplify do_fork_with_pid() #2

Submitted by Kirill Tkhai on May 15, 2017, 1:05 p.m.

Details

Message ID 149485350216.681.44190032069601287.stgit@localhost.localdomain
State New
Series "Refactor pid_ns helpers creation"
Headers show

Commit Message

Kirill Tkhai May 15, 2017, 1:05 p.m.
Move xfree() up

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

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 966a759b6..9a4732d77 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();