This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: fix crash-causing bug in copy_type_recursive
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org, Tom Tromey <tromey at redhat dot com>
- Date: Mon, 10 Nov 2008 20:46:13 +0000
- Subject: Re: RFA: fix crash-causing bug in copy_type_recursive
- References: <m3iqqvjrou.fsf@fleche.redhat.com>
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