]> granicus.if.org Git - python/commitdiff
bpo-30704, bpo-30604: Fix memleak in code_dealloc() (#2455) (#2456)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 28 Jun 2017 00:28:51 +0000 (02:28 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Jun 2017 00:28:51 +0000 (02:28 +0200)
Free also co_extra->ce_extras, not only co_extra.
(cherry picked from commit 23e7944eba1968bb8432fdc4cc96d4fdd2c1a230)

Objects/codeobject.c

index d38f185ba3b8e4d20b69d540486aba006c09162a..6de697ae3fd31c7ed41a5fb4666a71b85066af99 100644 (file)
@@ -422,7 +422,8 @@ code_dealloc(PyCodeObject *co)
             }
         }
 
-        PyMem_FREE(co->co_extra);
+        PyMem_Free(co_extra->ce_extras);
+        PyMem_Free(co_extra);
     }
 
     Py_XDECREF(co->co_code);