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: RFA free(NULL) in bcache.c



Yes, please do.  Thanks.

> I recently have had a core dump there, and the other instance of
> `free (bcache->bucket)' in bache.c is protected against `free (NULL)', so
> I think this is safe.  OK to commit ?
> 
> Philippe De Muyter  <phdm@macqel.be>
> 
> 	* bcache.c (free_bcache): Do not free NULL.
> 
> Index: gdb/bcache.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/bcache.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 bcache.c
> --- bcache.c	2000/02/08 04:39:01	1.2
> +++ bcache.c	2000/04/12 08:52:26
> @@ -189,7 +189,8 @@ void
>  free_bcache (struct bcache *bcache)
>  {
>    obstack_free (&bcache->cache, 0);
> -  free (bcache->bucket);
> +  if (bcache->bucket)
> +    free (bcache->bucket);
>  
>    /* This isn't necessary, but at least the bcache is always in a
>       consistent state.  */
> 

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