]> git.sesse.net Git - vlc/commitdiff
decomp: avoid large stack allocation
authorRémi Denis-Courmont <remi@remlab.net>
Fri, 26 Mar 2010 17:31:23 +0000 (19:31 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 26 Mar 2010 17:31:41 +0000 (19:31 +0200)
(It could be more efficient, but who cares? pipe overhead is probably
 worse)

modules/stream_filter/decomp.c

index b300fa94693ae9e700037891397b92d34f993827..fd5c1edd87233d79a8d742fb041d342c65cdb59a 100644 (file)
@@ -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);