[Patch, Fortran] PR58803 - Prevent a double-free with proc-pointer components
Tobias Burnus
burnus@net-b.de
Mon Oct 21 17:27:00 GMT 2013
As written in the PR:
The problem is that in free_components one frees:
2054 free_components (gfc_component *p)
...
2058 for (; p; p = q)
2059 {
2060 q = p->next;
2061
2062 gfc_free_array_spec (p->as);
2063 gfc_free_expr (p->initializer);
2064 free (p->tb);
2065
2066 free (p);
2067 }
Here:
p->name == "f1"
p->tb == (gfc_typebound_proc *) 0x17e0070
when one then cycles to p = q (i.e. to p->next), one has:
p->name == "f2"
p->tb == (gfc_typebound_proc *) 0x17e0070
The patch is rather straight forward.
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc.diff
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131021/9d41e90d/attachment.bin>
More information about the Gcc-patches
mailing list