From 04c0207ebb3cb7f894b5f5b6320970aabda477a9 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 14 Feb 2023 22:50:42 +0000 Subject: Fix a bunch of memory leaks in feature 'class' * Free the attrlist OP fragment when applying class or field attribute * Free the OP_PADxV ops we only use to get the pad index out for fieldvar declarations * Add a refcount to the `struct padname_fieldinfo` to keep track of its capture in inner closures so it can be freed at the right time * Free the class-related fields out of HvAUX * Free the actual ObjectFIELDS() array when destroying an object instance * Dup fieldinfo->paramname at sv_dup() time / free it at free time --- pad.h | 1 + 1 file changed, 1 insertion(+) (limited to 'pad.h') diff --git a/pad.h b/pad.h index 53b27bb3bf..8f339ae6c4 100644 --- a/pad.h +++ b/pad.h @@ -94,6 +94,7 @@ struct padname_with_str { * own substructure, stored in ->xpadn_fieldinfo. */ struct padname_fieldinfo { + U32 refcount; PADOFFSET fieldix; /* index of this field within ObjectFIELDS() array */ HV *fieldstash; /* original class package which added this field */ OP *defop; /* optree fragment for defaulting expression */ -- cgit v1.2.1