RFA: fix crash-causing bug in copy_type_recursive
Pedro Alves
pedro@codesourcery.com
Mon Nov 10 21:22:00 GMT 2008
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
More information about the Gdb-patches
mailing list