[vlc-commits] commit: decomp: handle memory error ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Fri Mar 26 18:38:56 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Mar 26 19:31:12 2010 +0200| [072b0670800c6c9ab9d9f644c43c9220931601bd] | committer: Rémi Denis-Courmont 

decomp: handle memory error

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=072b0670800c6c9ab9d9f644c43c9220931601bd
---

 modules/stream_filter/decomp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/modules/stream_filter/decomp.c b/modules/stream_filter/decomp.c
index 6ec32da..b300fa9 100644
--- a/modules/stream_filter/decomp.c
+++ b/modules/stream_filter/decomp.c
@@ -95,7 +95,7 @@ static void *Thread (void *data)
     stream_t *stream = data;
     stream_sys_t *p_sys = stream->p_sys;
 #ifdef HAVE_VMSPLICE
-    ssize_t page_mask = sysconf (_SC_PAGE_SIZE) - 1;
+    const ssize_t page_mask = sysconf (_SC_PAGE_SIZE) - 1;
 #endif
     int fd = p_sys->write_fd;
     bool error = false;
@@ -107,6 +107,8 @@ static void *Thread (void *data)
 #ifdef HAVE_VMSPLICE
         unsigned char *buf = mmap (NULL, bufsize, PROT_READ|PROT_WRITE,
                                    MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+        if (unlikely(buf == MAP_FAILED))
+            break;
         vlc_cleanup_push (cleanup_mmap, buf);
 #else
         unsigned char buf[bufsize];



More information about the vlc-commits mailing list