prologue-value.c memory leak fix.

Pedro Alves pedro_alves@portugalmail.pt
Sat Nov 18 23:07:00 GMT 2006


There is a leak in prologue-value.c, in clear_values:

The do while loop always runs exactly once.
The attached patch fixes it.

/* Delete all entries from AREA.  */
static void
clear_entries (struct pv_area *area)
{
  struct area_entry *e = area->entry;

  if (e)
    {
      /* This needs to be a do-while loop, in order to actually
         process the node being checked for in the terminating
         condition.  */
      do
        {
          struct area_entry *next = e->next;
          xfree (e);
        }
      while (e != area->entry);

      area->entry = 0;
    }
}

Please review and commit.

Cheers,
Pedro Alves

---

2006-11-18 Pedro Alves <pedro_alves@portugalmail.pt>

prologue-value.c (clear_entries): Fix memory leak.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: prologue-value.c.diff
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20061118/3f39e363/attachment.ksh>


More information about the Gdb-patches mailing list