Re: [libvirt] [PATCH] tests: avoid NULL deref upon OOM failure

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

 



On Tue, Feb 16, 2010 at 09:39:25AM +0100, Jim Meyering wrote:
> Pretty obvious:
> 
> >From 3e79d8839c5051461197a7c484adb32f7f04377a Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@xxxxxxxxxx>
> Date: Tue, 16 Feb 2010 09:36:57 +0100
> Subject: [PATCH] tests: avoid NULL deref upon OOM failure
> 
> * tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Handle malloc
> failure.
> ---
>  tests/qemuxml2argvtest.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 3ee71a3..aa42f99 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -98,7 +98,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
>          len += strlen(*tmp) + 1;
>          tmp++;
>      }
> -    actualargv = malloc(sizeof(*actualargv)*len);
> +    if ((actualargv = malloc(sizeof(*actualargv)*len)) == NULL)
> +        goto fail;
>      actualargv[0] = '\0';
>      tmp = qenv;
>      while (*tmp) {

  sure, ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]