This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] null pointer guard, target-descriptions.c
- From: msnyder at sonic dot net
- To: msnyder at sonic dot net, gdb-patches at sourceware dot org
- Date: Mon, 2 Jul 2007 17:40:12 -0700 (PDT)
- Subject: Re: [PATCH] null pointer guard, target-descriptions.c
- References: <17674.12.7.175.2.1183064463.squirrel@webmail.sonic.net> <20070701160007.GG10872@caradoc.them.org>
> On Thu, Jun 28, 2007 at 02:01:03PM -0700, Michael Snyder wrote:
>> Possible null pointer ref, flagged by Coverity
>>
>
>> 2007-06-28 Michael Snyder <msnyder@access-company.com>
>>
>> * target-descriptions.c (tdesc-_named_type): Guard against null
>> type-id argument which may be passed by tdesc_create_reg (Coverity).
>
> Whoops, yeah - this one's my fault. There's another place in the same
> file which will crash if reg->type == NULL. How about we never set it
> to NULL instead? Like below.
That certainly solves the issue for now -- since it's only called
from one place -- but if we just went ahead and checked it for null,
we wouldn't have to worry about it coming up again.
But it's your code, so your choice... if you prefer your patch,
consider this approval. ;-)