diff --git a/ChangeLog b/ChangeLog index 26d254ffc9..207854eab5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Feb 4 22:22:34 +0100 2009 Jim Meyering + + 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. + Tue Feb 3 14:06:06 +0100 2009 Jim Meyering avoid a format-related warning diff --git a/src/lxc_container.c b/src/lxc_container.c index ea52eed93e..90c70d5367 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; } -