From: John Ferlan Date: Mon, 7 Jan 2013 17:09:33 +0000 (-0500) Subject: lxc: Avoid possible NULL dereference on *root prior to opendir(). X-Git-Tag: v1.0.2-rc1~267 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36ac6e37bec9c2b7043ca9f78386fca1f73de0c0;p=thirdparty%2Flibvirt.git 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. --- 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,