PerlIO_tmpfile: Don't leak an SV
authorBrian Fraser <fraserbn@gmail.com>
Wed, 22 Jan 2014 01:46:10 +0000 (22:46 -0300)
committerBrian Fraser <fraserbn@gmail.com>
Wed, 22 Jan 2014 02:21:07 +0000 (23:21 -0300)
This was spotted by Daniel Dragan on the thread for #120591

perlio.c

index ec19bfe..07de32a 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -4967,6 +4967,7 @@ PerlIO_tmpfile(void)
         fd = mkstemp(SvPVX(sv));
      }
      if (fd < 0) {
+        SvREFCNT_dec(sv);
         sv = NULL;
         /* else we try /tmp */
         fd = mkstemp(tempname);