[libvirt] [PATCH] qemu_driver.c: don't unlink(NULL) on OOM error path
Daniel Veillard
veillard at redhat.com
Tue Dec 15 15:19:25 UTC 2009
On Mon, Dec 14, 2009 at 04:42:03PM +0100, Jim Meyering wrote:
> Not terribly likely, but not impossible, either:
>
> >From dc8fe76ed209d04b1e962b94b20da17a077e102f Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Mon, 14 Dec 2009 16:41:11 +0100
> Subject: [PATCH] qemu_driver.c: don't unlink(NULL) on OOM error path
>
> * src/qemu/qemu_driver.c (qemudDomainMigratePrepareTunnel): Upon an
> out of memory error, we would end up with unixfile==NULL and attempt
> to unlink(NULL). Skip the unlink when it's NULL.
> ---
> src/qemu/qemu_driver.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 56bcec5..04b2511 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -6903,7 +6903,8 @@ endjob:
>
> cleanup:
> virDomainDefFree(def);
> - unlink(unixfile);
> + if (unixfile)
> + unlink(unixfile);
> VIR_FREE(unixfile);
> if (vm)
> virDomainObjUnlock(vm);
ACK, let's avoid the risk,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list