[vlc-devel] commit: Fix block leak in block_Realloc corner case (CID 78) ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri May 30 18:09:22 CEST 2008


vlc | branch: 0.8.6-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Fri May 30 19:10:53 2008 +0300| [8cebbe66b6ab346bd3e655807f98dce045db8476]

Fix block leak in block_Realloc corner case (CID 78)

block_Realloc() is a lot more intelligent in 0.9.0 nowadays, but I would
rather not commit large changes to -bugfix...

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

 src/misc/block.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/misc/block.c b/src/misc/block.c
index be4e453..829211d 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -99,7 +99,11 @@ block_t *block_Realloc( block_t *p_block, int i_prebody, int i_body )
 
     i_buffer_size = i_prebody + i_body;
 
-    if( i_body < 0 || i_buffer_size <= 0 ) return NULL;
+    if( i_body < 0 || i_buffer_size <= 0 )
+    {
+        block_Release( p_block );
+        return NULL;
+    }
 
     if( p_block->p_buffer - i_prebody > p_block->p_sys->p_allocated_buffer &&
         p_block->p_buffer - i_prebody < p_block->p_sys->p_allocated_buffer +




More information about the vlc-devel mailing list