Steve Kargl wrote:
On Mon, Oct 21, 2013 at 07:15:07PM +0200, Tobias Burnus wrote:
-      c->tb = tb;
+      if (num == 1)
+       c->tb = tb;
+      else
+       {
+         c->tb = XCNEW (gfc_typebound_proc);
+         c->tb->where = gfc_current_locus;
+         *c->tb = *tb;
I haven't convinced myself yet, but is this leaking memory?

Lines 5006-7 are

   tb = XCNEW (gfc_typebound_proc);
   tb->where = gfc_current_locus;

In the num = 1 case, c->tb = tb and I presume during teardown
c->tb is freed and by extension tb.  But, in the else case,
are you copying the contents from *tb into *c->tb and the tb
is never freed?

Well, as the double-free PR shows, free_components frees the memory: "free (p->tb);". And as it walks all components …

Tobias

Reply via email to