about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-27 08:20:59 +0000
committerEric Wong <e@80x24.org>2016-05-27 08:24:12 +0000
commit3344815088512287243b622658dbb7fbea87beb1 (patch)
tree2a30df4fa0090eac626d429321aa189164444139
parent8080aa02383623837770ae12aba85f010442a1f6 (diff)
downloadpublic-inbox-3344815088512287243b622658dbb7fbea87beb1.tar.gz
The generic PSGI code needs to avoid resource leaks if
smart cloning is disabled (due to resource contraints).
-rw-r--r--lib/PublicInbox/GitHTTPBackend.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 18194441..58e75cde 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -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) {