This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] more robust free_current_contents + mi cleanup cleanup


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]