]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git-http-backend: close pipe for generic PSGI on errors
authorEric Wong <e@80x24.org>
Fri, 27 May 2016 08:20:59 +0000 (08:20 +0000)
committerEric Wong <e@80x24.org>
Fri, 27 May 2016 08:24:12 +0000 (08:24 +0000)
The generic PSGI code needs to avoid resource leaks if
smart cloning is disabled (due to resource contraints).

lib/PublicInbox/GitHTTPBackend.pm

index 18194441e888da321250b5ab3609cce544e515ac..58e75cde50e20cd35d8ecd7ae1beb7b1aacf1009 100644 (file)
@@ -210,7 +210,12 @@ sub serve_smart {
                my $r = $rd_hdr->() or return;
                $rd_hdr = undef;
                if (scalar(@$r) == 3) { # error:
-                       $async->close if $async;
+                       if ($async) {
+                               $async->close; # calls rpipe->close
+                       } else {
+                               $rpipe->close;
+                               $end->();
+                       }
                        return $res->($r);
                }
                if ($async) {