mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-29 17:33:09 +00:00
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.
This commit is contained in:
parent
41549b3888
commit
7faa50d1db
@ -1,3 +1,10 @@
|
|||||||
|
Wed Feb 4 22:22:34 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
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 <meyering@redhat.com>
|
Tue Feb 3 14:06:06 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
avoid a format-related warning
|
avoid a format-related warning
|
||||||
|
@ -284,20 +284,20 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = virFileMakePath(oldroot)) < 0) {
|
if ((rc = virFileMakePath(oldroot)) < 0) {
|
||||||
VIR_FREE(oldroot);
|
|
||||||
virReportSystemError(NULL, rc,
|
virReportSystemError(NULL, rc,
|
||||||
_("failed to create %s"),
|
_("failed to create %s"),
|
||||||
oldroot);
|
oldroot);
|
||||||
|
VIR_FREE(oldroot);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The old root directory will live at /.oldroot after
|
/* The old root directory will live at /.oldroot after
|
||||||
* this and will soon be unmounted completely */
|
* this and will soon be unmounted completely */
|
||||||
if (pivot_root(root->src, oldroot) < 0) {
|
if (pivot_root(root->src, oldroot) < 0) {
|
||||||
VIR_FREE(oldroot);
|
|
||||||
virReportSystemError(NULL, errno,
|
virReportSystemError(NULL, errno,
|
||||||
_("failed to pivot root %s to %s"),
|
_("failed to pivot root %s to %s"),
|
||||||
oldroot, root->src);
|
oldroot, root->src);
|
||||||
|
VIR_FREE(oldroot);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
VIR_FREE(oldroot);
|
VIR_FREE(oldroot);
|
||||||
@ -677,4 +677,3 @@ int lxcContainerAvailable(int features)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user