[vlc-commits] transcode: fix null-deref in some error cases

Thomas Guillem git at videolan.org
Fri Jan 19 08:37:12 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 19 08:30:30 2018 +0100| [969da8f53d05a45b7b064e8530c648dbd565ab51] | committer: Thomas Guillem

transcode: fix null-deref in some error cases

Null-deref could happen when flushing (p_buffer == NULL).

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

 modules/stream_out/transcode/transcode.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index f96c6e61e6..ced21cff37 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -590,9 +590,8 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
     {
         if( id->id )
             return sout_StreamIdSend( p_stream->p_next, id->id, p_buffer );
-
-        block_Release( p_buffer );
-        return VLC_EGENERIC;
+        else
+            goto error;
     }
 
     switch( id->p_decoder->fmt_in.i_cat )
@@ -622,12 +621,14 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
         break;
 
     default:
-        p_out = NULL;
-        block_Release( p_buffer );
-        break;
+        goto error;
     }
 
     if( p_out )
         return sout_StreamIdSend( p_stream->p_next, id->id, p_out );
     return VLC_SUCCESS;
+error:
+    if( p_buffer )
+        block_Release( p_buffer );
+    return VLC_EGENERIC;
 }



More information about the vlc-commits mailing list