vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Thu Jun 21 
06:05:51 2012 +0300| [46a8f555cc0d2205a2125354de312a7c0067b734] | committer: 
Rémi Denis-Courmont

block_Release(): add one more sanity check

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

 src/misc/block.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/misc/block.c b/src/misc/block.c
index 8179178..f99c2a2 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -99,8 +99,10 @@ void block_Init( block_t *restrict b, void *buf, size_t size 
)
 #endif
 }
 
-static void BlockRelease (block_t *block)
+static void block_generic_Release (block_t *block)
 {
+    /* That is always true for blocks allocated with block_Alloc(). */
+    assert (block->p_start == (unsigned char *)(block + 1));
     block_Invalidate (block);
     free (block);
 }
@@ -140,7 +142,7 @@ block_t *block_Alloc (size_t size)
     b->p_buffer += BLOCK_PADDING + BLOCK_ALIGN - 1;
     b->p_buffer = (void *)(((uintptr_t)b->p_buffer) & ~(BLOCK_ALIGN - 1));
     b->i_buffer = size;
-    b->pf_release = BlockRelease;
+    b->pf_release = block_generic_Release;
     return b;
 }
 

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to