From: RĂ©mi Denis-Courmont Date: Fri, 26 Mar 2010 17:31:23 +0000 (+0200) Subject: decomp: avoid large stack allocation X-Git-Tag: 1.1.0-pre1~301 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=40cc130202e898d57c6c93af1407cbf5ac6b6bd1;p=vlc decomp: avoid large stack allocation (It could be more efficient, but who cares? pipe overhead is probably worse) --- diff --git a/modules/stream_filter/decomp.c b/modules/stream_filter/decomp.c index b300fa9469..fd5c1edd87 100644 --- a/modules/stream_filter/decomp.c +++ b/modules/stream_filter/decomp.c @@ -111,7 +111,10 @@ static void *Thread (void *data) break; vlc_cleanup_push (cleanup_mmap, buf); #else - unsigned char buf[bufsize]; + unsigned char *buf = malloc (bufsize); + if (unlikely(buf == NULL)) + break; + vlc_cleanup_push (free, buf); #endif len = stream_Read (stream->p_source, buf, bufsize); @@ -140,9 +143,7 @@ static void *Thread (void *data) break; } } -#ifdef HAVE_VMSPLICE - vlc_cleanup_run (); /* munmap (buf, bufsize) */ -#endif + vlc_cleanup_run (); /* free (buf) */ } while (!error);