From 40cc130202e898d57c6c93af1407cbf5ac6b6bd1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Fri, 26 Mar 2010 19:31:23 +0200 Subject: [PATCH] decomp: avoid large stack allocation (It could be more efficient, but who cares? pipe overhead is probably worse) --- modules/stream_filter/decomp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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); -- 2.39.5