Hi,
On 07/06/2009 01:08 PM, gkovacs wrote:
Author: gkovacs
Date: Mon Jul 6 22:08:38 2009
New Revision: 4641
Log:
switched to av_fast_realloc in m3u_list_files
Modified:
concat/libavformat/m3u.c
Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c Mon Jul 6 21:25:34 2009 (r4640)
+++ concat/libavformat/m3u.c Mon Jul 6 22:08:38 2009 (r4641)
@@ -41,13 +41,10 @@ static int m3u_probe(AVProbeData *p)
}
static int m3u_list_files(ByteIOContext *s, PlaylistContext *ctx)
-// char ***flist_ptr,
-// unsigned int *lfx_ptr,
-// char *workingdir)
{
char **flist;
int i, j;
- int bufsize = 16;
+ int bufsize = 0;
i = 0;
flist = av_malloc(sizeof(char*) * bufsize);
while (1) {
@@ -56,11 +53,8 @@ static int m3u_list_files(ByteIOContext
break;
if (*c == 0) // hashed out
continue;
- flist[i] = c;
- if (++i == bufsize) {
- bufsize += 16;
- flist = av_realloc(flist, sizeof(char*) * bufsize);
- }
+ flist = av_fast_realloc(flist,&bufsize, i+2);
+ flist[i++] = c;
Missing null return check and beware of memleak.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
_______________________________________________
FFmpeg-soc mailing list
FFmpeg-soc@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc