[vlc-commits] commit: stream_filter/httplive.c: Bail out if block_Realloc() fails in AccessDownload(). (Jean-Paul Saman )

git at videolan.org git at videolan.org
Wed Nov 3 15:22:34 CET 2010


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Nov  3 14:44:56 2010 +0100| [6ab6ab61211da8b561098fb7ef51fc3dfe350a6f] | committer: Jean-Paul Saman 

stream_filter/httplive.c: Bail out if block_Realloc() fails in AccessDownload().

If block_Realloc() fails in the function AccessDownload() then resolving
segment->data->i_buffer results in a segmentation error. Instead of continuing
when block_Realloc() has failed, just cleanup and leave the function.

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

 modules/stream_filter/httplive.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 9e61255..2e0e374 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1087,8 +1087,12 @@ static int AccessDownload(stream_t *s, segment_t *segment)
         {
             msg_Dbg(s, "size changed %"PRIu64, segment->size);
             segment->data = block_Realloc(segment->data, 0, p_sys->p_access->info.i_size);
-            if (segment->data)
-                segment->size = p_sys->p_access->info.i_size;
+            if (segment->data == NULL)
+            {
+                AccessClose(s);
+                return VLC_ENOMEM;
+            }
+            segment->size = p_sys->p_access->info.i_size;
             assert(segment->data->i_buffer == segment->size);
         }
         length = p_sys->p_access->pf_read(p_sys->p_access,



More information about the vlc-commits mailing list