[CRIU] [PATCH 2/5] files-reg: Don't dereference pointer before its NULL check

Pavel Emelyanov xemul at parallels.com
Tue Aug 5 01:56:49 PDT 2014


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---
 files-reg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/files-reg.c b/files-reg.c
index 5a69fef..5442735 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -460,14 +460,14 @@ static int create_link_remap(char *path, int len, int lfd,
 	if (rlb)
 		rlb->path = strdup(link_name);
 
-	rlb->mnt_ns = nsid;
-
 	if (!rlb || !rlb->path) {
 		pr_perror("Can't register rollback for %s", path);
 		xfree(rlb ? rlb->path : NULL);
 		xfree(rlb);
 		return -1;
 	}
+
+	rlb->mnt_ns = nsid;
 	list_add(&rlb->list, &link_remaps);
 
 	return pb_write_one(fdset_fd(glob_fdset, CR_FD_REG_FILES), &rfe, PB_REG_FILE);
-- 
1.8.4.2




More information about the CRIU mailing list