re-fix leak in Devel-PPPort
authorDavid Mitchell <davem@iabyn.com>
Wed, 3 Apr 2019 13:14:13 +0000 (14:14 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sat, 27 Apr 2019 17:24:33 +0000 (18:24 +0100)
This the context of this commit (v5.29.10-31-g613175fa07) was
accidentally reverted by v5.29.10-25-gaadf4f9e12, so I'm re-applying it
blead here.

-------

The leaky code is only used during test. It creates 3 ops, does various
operations related to linking OpSIBLINGs, then fails to free them.

dist/Devel-PPPort/parts/inc/misc

index 3fcc45b..2bd2dcf 100644 (file)
@@ -578,6 +578,7 @@ OpSIBLING_tests()
        PREINIT:
                OP *x;
                OP *kid;
+               OP *middlekid;
                OP *lastkid;
                int count = 0;
                int failures = 0;
@@ -601,6 +602,7 @@ OpSIBLING_tests()
                        kid = OpSIBLING(kid);
                        lastkid = kid;
                }
+                middlekid = OpSIBLING(x);
 
                /* Should now have a sibling */
                if (! OpHAS_SIBLING(x) || ! OpSIBLING(x) ) {
@@ -644,6 +646,9 @@ OpSIBLING_tests()
                        failures++; warn("Op should have had a sib after maybesibset");
                }
 
+                op_free(lastkid);
+                op_free(middlekid);
+                op_free(x);
                RETVAL = failures;
        OUTPUT:
                RETVAL