[vlc-commits] demux: webvtt: release memstream empty alloc

Francois Cartegnie git at videolan.org
Mon Feb 26 14:37:26 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 26 14:34:25 2018 +0100| [effce728d5128e30ee13fc3f90ab5a393c29e35e] | committer: Francois Cartegnie

demux: webvtt: release memstream empty alloc

(cherry picked from commit 87c3db495293b1c5e1f4cf764d74e63add0bb2a8)

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

 modules/demux/webvtt.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/demux/webvtt.c b/modules/demux/webvtt.c
index fb639df28f..ae672f9695 100644
--- a/modules/demux/webvtt.c
+++ b/modules/demux/webvtt.c
@@ -151,6 +151,11 @@ static void memstream_Grab( struct vlc_memstream *ms, void **pp, size_t *pi )
 {
     if( ms->stream != NULL && vlc_memstream_close( ms ) == VLC_SUCCESS )
     {
+        if( ms->length == 0 )
+        {
+            free( ms->ptr );
+            ms->ptr = NULL;
+        }
         *pp = ms->ptr;
         *pi = ms->length;
     }



More information about the vlc-commits mailing list