qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 13/13] qapi: Add missing null check to opts_star


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 13/13] qapi: Add missing null check to opts_start_struct()
Date: Mon, 10 Feb 2014 08:28:29 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 02/10/2014 07:20 AM, Markus Armbruster wrote:
> Argument is null when visiting an unboxed struct.  I can't see such a
> visit in the current code.  Fix it anyway.

Is this a sign of missing testsuite coverage?

> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  qapi/opts-visitor.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <address@hidden>

> 
> diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
> index 96ed858..5d830a2 100644
> --- a/qapi/opts-visitor.c
> +++ b/qapi/opts-visitor.c
> @@ -124,7 +124,9 @@ opts_start_struct(Visitor *v, void **obj, const char 
> *kind,
>      OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v);
>      const QemuOpt *opt;
>  
> -    *obj = g_malloc0(size > 0 ? size : 1);
> +    if (obj) {
> +        *obj = g_malloc0(size > 0 ? size : 1);
> +    }
>      if (ov->depth++ > 0) {
>          return;
>      }
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]