about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-23 18:20:45 -0600
committerEric Wong <e@80x24.org>2021-10-24 02:20:33 +0000
commit48af2131c7ef0e7001f99fe3c2dabd1713d3e800 (patch)
tree6354be468fb22ef0b33f236ed3789a4da8999fe8 /lib/PublicInbox/Git.pm
parent08b543eb6c67cc19ea8e86afe6b9494df79e2fea (diff)
downloadpublic-inbox-48af2131c7ef0e7001f99fe3c2dabd1713d3e800.tar.gz
Creating a scalar ref directly off substr() seemed to be causing
the underlying non-ref scalar to end up in Perl's scratchpad.
Assign the substr result to a local variable seems sufficient to
prevent multi-megabyte SVs from lingering indefinitely when a
read-only daemon serves rare, oversized blobs.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 374a3b4d..4078dd5b 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -158,7 +158,8 @@ sub my_read ($$$) {
                         return; # unrecoverable error
                 }
         }
-        \substr($$rbuf, 0, $len, '');
+        my $no_pad = substr($$rbuf, 0, $len, '');
+        \$no_pad;
 }
 
 sub my_readline ($$) {