From: Father Chrysostomos Date: Mon, 5 Nov 2012 02:21:34 +0000 (-0800) Subject: op.c:opslab_force_free: Make paranoid code reflect reality X-Git-Tag: upstream/5.20.0~4942 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bf28c7efbcf1a4748684c5e67060fc0deaa9427;p=platform%2Fupstream%2Fperl.git op.c:opslab_force_free: Make paranoid code reflect reality When opslab_force_free is called, the CV still has a reference count on the slab. In fact, we don’t even bother lowering it if all goes well, but simply free the slab with the reference count set to 1. So the paranoid code that increments the reference count before free- ing an op is not necessary. Also, the shortcut out of the loop was never triggered, as it was checking for a reference count of 0, rather than 1. --- diff --git a/op.c b/op.c index 488665f..93b71bd 100644 --- a/op.c +++ b/op.c @@ -380,9 +380,8 @@ Perl_opslab_force_free(pTHX_ OPSLAB *slab) ) ) { assert(slot->opslot_op.op_slabbed); - slab->opslab_refcnt++; /* op_free may free slab */ op_free(&slot->opslot_op); - if (!--slab->opslab_refcnt) goto free; + if (slab->opslab_refcnt == 1) goto free; } } } while ((slab2 = slab2->opslab_next));