From: Howard Chu Date: Sat, 23 Jul 2011 01:06:27 +0000 (-0700) Subject: Plug potential memleak X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b627335dc37fd5265ac6d23a441ee2d89ab503c8;p=rtmpdump Plug potential memleak Reported by Reijo Tomperi --- diff --git a/rtmpdump.c b/rtmpdump.c index 89c053a..e506fa9 100644 --- a/rtmpdump.c +++ b/rtmpdump.c @@ -444,7 +444,7 @@ Download(RTMP * rtmp, // connected RTMP object { int32_t now, lastUpdate; int bufferSize = 64 * 1024; - char *buffer = (char *) malloc(bufferSize); + char *buffer; int nRead = 0; off_t size = ftello(file); unsigned long lastPercent = 0; @@ -505,6 +505,8 @@ Download(RTMP * rtmp, // connected RTMP object rtmp->m_read.nMetaHeaderSize = nMetaHeaderSize; rtmp->m_read.nInitialFrameSize = nInitialFrameSize; + buffer = (char *) malloc(bufferSize); + now = RTMP_GetTime(); lastUpdate = now - 1000; do