From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7BD6B1FD6E for ; Sun, 7 Feb 2021 08:52:03 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 19/19] httpd/async: avoid unnecessary on-stack delete Date: Sun, 7 Feb 2021 08:52:01 +0000 Message-Id: <20210207085201.13871-20-e@80x24.org> In-Reply-To: <20210207085201.13871-1-e@80x24.org> References: <20210207085201.13871-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: While this doesn't fix a known problem, this was a risky construct in case somebody uses confess/longmess inside the user-supplied callback. cf. commit 0795b0906cc81f40 ("ds: guard against stack-not-refcounted quirk of Perl 5") --- lib/PublicInbox/HTTPD/Async.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm index 1de9501d..7238650a 100644 --- a/lib/PublicInbox/HTTPD/Async.pm +++ b/lib/PublicInbox/HTTPD/Async.pm @@ -46,7 +46,7 @@ sub event_step { my ($self) = @_; if (my $cb = delete $self->{cb}) { # this may call async_pass when headers are done - $cb->(delete $self->{arg}); + $cb->(my $refcnt_guard = delete $self->{arg}); } elsif (my $sock = $self->{sock}) { my $http = $self->{http}; # $self->{sock} is a read pipe for git-http-backend or cgit