This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [patch] more robust free_current_contents + mi cleanup cleanup
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: [patch] more robust free_current_contents + mi cleanup cleanup
- From: Chris Faylor <cgf at cygnus dot com>
- Date: Tue, 16 May 2000 01:02:55 -0400
- Cc: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- References: <3920D564.86185905@cygnus.com>
- Reply-To: gdb-patches at sourceware dot cygnus dot com
On Tue, May 16, 2000 at 02:58:12PM +1000, Andrew Cagney wrote:
>Index: utils.c
>===================================================================
>RCS file: /cvs/src/src/gdb/utils.c,v
>retrieving revision 1.10
>diff -p -r1.10 utils.c
>*** utils.c 2000/05/16 02:43:39 1.10
>--- utils.c 2000/05/16 04:54:29
>*************** void
>*** 390,397 ****
> free_current_contents (void *ptr)
> {
> void **location = ptr;
> if (*location != NULL)
>! free (*location);
> }
>
> /* Provide a known function that does nothing, to use as a base for
>--- 390,402 ----
> free_current_contents (void *ptr)
> {
> void **location = ptr;
>+ if (location == NULL)
>+ internal_error ("free_current_contents: NULL pointer");
> if (*location != NULL)
Wouldn't an "else" be a little clearer here instead of another test of
*location?
>! {
>! free (*location);
>! *location = NULL;
>! }
> }
>
> /* Provide a known function that does nothing, to use as a base for
cgf