From: Eric Wong Date: Sun, 7 Feb 2021 08:52:01 +0000 (+0000) Subject: httpd/async: avoid unnecessary on-stack delete X-Git-Tag: v1.7.0~1169 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=072d326a8acb2633fbbadf87005b7e546e3da832;p=public-inbox.git httpd/async: avoid unnecessary on-stack delete 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") --- 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