From 36ac6e37bec9c2b7043ca9f78386fca1f73de0c0 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Mon, 7 Jan 2013 12:09:33 -0500 Subject: [PATCH] lxc: Avoid possible NULL dereference on *root prior to opendir(). If running on older Linux without mounted cgroups then its possible that *root would be NULL. --- src/lxc/lxc_container.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index d3a2968d3b..d234426ff8 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1762,6 +1762,12 @@ static int lxcContainerIdentifyCGroups(struct lxcContainerCGroup **mountsret, VIR_DEBUG("Grabbed '%s'", mntent.mnt_dir); } + if (!*root) { + VIR_DEBUG("No mounted cgroups found"); + ret = 0; + goto cleanup; + } + VIR_DEBUG("Checking for symlinks in %s", *root); if (!(dh = opendir(*root))) { virReportSystemError(errno,