fix leak in APItest.xs
authorDavid Mitchell <davem@iabyn.com>
Wed, 25 Sep 2019 20:46:47 +0000 (21:46 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 25 Sep 2019 20:51:29 +0000 (21:51 +0100)
The leak Was introduced by my recent commit v5.31.4-16-g4df857782a,
which added an extra op at the head of a signature subtree, but which
wasn't being freed by the code in the parse_subsignature test.

ext/XS-APItest/APItest.xs

index cd58b52..777add5 100644 (file)
@@ -1055,7 +1055,7 @@ static OP *THX_parse_keyword_arrayexprflags(pTHX)
 #define parse_keyword_subsignature() THX_parse_keyword_subsignature(aTHX)
 static OP *THX_parse_keyword_subsignature(pTHX)
 {
-    OP *retop = NULL, *sigop = parse_subsignature(0);
+    OP *retop = NULL, *listop, *sigop = parse_subsignature(0);
     OP *kid;
     int seen_nextstate = 0;
 
@@ -1070,12 +1070,12 @@ static OP *THX_parse_keyword_subsignature(pTHX)
     
     if(!(sigop->op_flags & OPf_KIDS))
        croak("Expected parse_subsignature() to yield an OP_NULL with kids");
-    sigop = cUNOPx(sigop)->op_first;
+    listop = cUNOPx(sigop)->op_first;
 
-    if(sigop->op_type != OP_LINESEQ)
+    if(listop->op_type != OP_LINESEQ)
        croak("Expected parse_subsignature() to yield an OP_LINESEQ");
 
-    for(kid = cLISTOPx(sigop)->op_first; kid; kid = OpSIBLING(kid)) {
+    for(kid = cLISTOPx(listop)->op_first; kid; kid = OpSIBLING(kid)) {
        switch(kid->op_type) {
            case OP_NEXTSTATE:
                /* Only emit the first one otherwise they get boring */