[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu_driver.c: don't unlink(NULL) on OOM error path



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 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 veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]