[CRIU] [PATCH] cgroup: only reset directory when dirnew is valid

Tycho Andersen tycho.andersen at canonical.com
Tue Sep 13 17:21:43 PDT 2016


In the case where we don't rewrite anything, dirnew is never set, so we
shouldn't reset anything, because we didn't do any work.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 criu/cgroup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/criu/cgroup.c b/criu/cgroup.c
index 0869118..395420d 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -1719,8 +1719,10 @@ static int rewrite_cgsets(CgroupEntry *cge, char **controllers, int n_controller
 		}
 	}
 
-	xfree(dir);
-	*dir_name = dirnew;
+	if (dirnew) {
+		xfree(dir);
+		*dir_name = dirnew;
+	}
 	return 0;
 }
 
-- 
2.7.4



More information about the CRIU mailing list