This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
RT #73520: POSIX::strftime memory leak
authorTony Cook <tony@develop-help.com>
Sun, 11 Jul 2010 11:23:30 +0000 (21:23 +1000)
committerTony Cook <tony@develop-help.com>
Sun, 11 Jul 2010 11:23:30 +0000 (21:23 +1000)
Tested before/after with valgrind.

util.c

diff --git a/util.c b/util.c
index 652e868..b3b385e 100644 (file)
--- a/util.c
+++ b/util.c
@@ -4234,7 +4234,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in
     const int fmtlen = strlen(fmt);
     int bufsize = fmtlen + buflen;
 
-    Newx(buf, bufsize, char);
+    Renew(buf, bufsize, char);
     while (buf) {
       buflen = strftime(buf, bufsize, fmt, &mytm);
       if (buflen > 0 && buflen < bufsize)