[vlc-commits] block_Release(): add one more sanity check
Rémi Denis-Courmont
git at videolan.org
Thu Jun 21 05:06:22 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | 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;
}
More information about the vlc-commits
mailing list