vlc_block_helper: fix null deref (cid #1400161)
authorFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 9 Feb 2017 22:12:04 +0000 (23:12 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 9 Feb 2017 22:12:04 +0000 (23:12 +0100)
include/vlc_block_helper.h

index b94b461..d4e9a4b 100644 (file)
@@ -138,7 +138,8 @@ static inline block_t *block_BytestreamPop( block_bytestream_t *p_bytestream )
     p_block = p_block->p_next;
     p_block_old->p_next = NULL;
     p_bytestream->pp_last = &p_block_old->p_next;
-    p_bytestream->i_total -= p_block->i_buffer;
+    if( p_block )
+        p_bytestream->i_total -= p_block->i_buffer;
 
     return p_block;
 }