summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2023-02-05 11:31:14 +0000
committerPaul Evans <leonerd@leonerd.org.uk>2023-02-07 10:47:05 +0000
commitaa2d00d7d06d0ec6110c4351b635728dfa53bc81 (patch)
tree791676fa28384e0ff9f701beeca8f1afb94b641a /op.c
parent83ba55794efd51e7a10531c7e50a859fe310ffb0 (diff)
downloadperl-aa2d00d7d06d0ec6110c4351b635728dfa53bc81.tar.gz
Also add a note to the docs of op_free() to remind users about clearing the OPf_KIDS flag
Diffstat (limited to 'op.c')
-rw-r--r--op.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/op.c b/op.c
index ee3711713b..cdd6b4af34 100644
--- a/op.c
+++ b/op.c
@@ -849,6 +849,15 @@ S_op_destroy(pTHX_ OP *o)
Free an op and its children. Only use this when an op is no longer linked
to from any optree.
+Remember that any op with C<OPf_KIDS> set is expected to have a valid
+C<op_first> pointer. If you are attempting to free an op but preserve its
+child op, make sure to clear that flag before calling C<op_free()>. For
+example:
+
+ OP *kid = o->op_first; o->op_first = NULL;
+ o->op_flags &= ~OPf_KIDS;
+ op_free(o);
+
=cut
*/