Ticket #564 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

[BUG] pmc_reuse() doesn't call old PMC's destroy()

Reported by: cotto Owned by:
Priority: normal Milestone: 1.1
Component: none Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

In src/pmc.c, the function pmc_reuse() is used as a lightweight way to recycle a PMC by only destroying the unique parts of a PMC. It looks like this function has the potential for resource leaks since it doesn't call the old PMC's destroy() VTABLE function. The inlined patch fixes this. There are no new test failures, but it still seems wise to wait until after the 1.1 release to apply it, since it's only 24-48 hours away.

Index: src/pmc.c
===================================================================
--- src/pmc.c   (revision 38235)
+++ src/pmc.c   (working copy)
@@ -188,6 +188,10 @@
     /* Do we have an extension area? */
     has_ext = (PObj_is_PMC_EXT_TEST(pmc) && pmc->pmc_ext);
 
+    /* Does the old PMC need any resources freed? */
+    if (PObj_active_destroy_TEST(pmc))
+        VTABLE_destroy(interp, pmc);
+
     /* Do we need one? */
     if (new_vtable->flags & VTABLE_PMC_NEEDS_EXT) {

Change History

Changed 6 years ago by cotto

  • status changed from new to closed
  • resolution set to fixed

applied in r38258.

Note: See TracTickets for help on using tickets.