This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: RFA: fix crash-causing bug in copy_type_recursive


On Monday 10 November 2008 19:40:01, Tom Tromey wrote:
> On the Python branch I ran into a crash that was caused by
> copy_type_recursive not clearing the memory for new fields.  

> Built and regtested on x86-64 (compile farm).
> Ok?  (I almost checked this in as obvious...)
> 

Ok.

> @@ -2977,6 +2977,7 @@ copy_type_recursive (struct objfile *objfile,
>  
>        nfields = TYPE_NFIELDS (type);
>        TYPE_FIELDS (new_type) = xmalloc (sizeof (struct field) * nfields);
> +      memset (TYPE_FIELDS (new_type), 0, sizeof (struct field) * nfields);

Or xzalloc, or xcalloc, or XCALLOC even.

-- 
Pedro Alves


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