Spotted these while skimming through all VIR_FREE uses. >From af9e606d97e8321683ba765ba0a4af4c065d3b4b Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@xxxxxxxxxx> Date: Wed, 4 Feb 2009 18:44:34 +0100 Subject: [PATCH] lxc_container: Don't dereference NULL upon failure * src/lxc_container.c (lxcContainerPivotRoot): Free and zero oldroot *after* printing the diagnostic, both for virFileMakePath and pivot_root failure. --- src/lxc_container.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lxc_container.c b/src/lxc_container.c index ea52eed..90c70d5 100644 --- a/src/lxc_container.c +++ b/src/lxc_container.c @@ -284,20 +284,20 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root) } if ((rc = virFileMakePath(oldroot)) < 0) { - VIR_FREE(oldroot); virReportSystemError(NULL, rc, _("failed to create %s"), oldroot); + VIR_FREE(oldroot); return -1; } /* The old root directory will live at /.oldroot after * this and will soon be unmounted completely */ if (pivot_root(root->src, oldroot) < 0) { - VIR_FREE(oldroot); virReportSystemError(NULL, errno, _("failed to pivot root %s to %s"), oldroot, root->src); + VIR_FREE(oldroot); return -1; } VIR_FREE(oldroot); @@ -677,4 +677,3 @@ int lxcContainerAvailable(int features) return 0; } - -- 1.6.1.2.467.g081e7 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list