[vlc-commits] dirac: use xcalloc() rather than assert()

Rémi Denis-Courmont git at videolan.org
Mon Aug 29 17:41:19 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 29 18:26:52 2011 +0300| [6adccb85353730a51e296bba536fda2800a23599] | committer: Rémi Denis-Courmont

dirac: use xcalloc() rather than assert()

assert() is meant only for impossible errors (bugs), not for unlikely
errors. assert() does not check for errors in "release" builds.

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

 modules/packetizer/dirac.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/dirac.c b/modules/packetizer/dirac.c
index e7143be..ef899ef 100644
--- a/modules/packetizer/dirac.c
+++ b/modules/packetizer/dirac.c
@@ -239,8 +239,9 @@ static void dirac_ReleaseBlockAndEncap( block_t *p_block )
 
 static void dirac_AddBlockEncap( block_t **pp_block, dirac_block_encap_t *p_dbe )
 {
-    fake_block_t *p_fake = calloc( 1, sizeof( *p_fake ) );
-    assert( p_fake ); /* must not fail, fixby: adding a p_priv to block_t */
+    /* must not fail, fixby: adding a p_priv to block_t */
+    fake_block_t *p_fake = xcalloc( 1, sizeof( *p_fake ) );
+
     p_fake->p_orig = *pp_block;
     memcpy( &p_fake->fake, *pp_block, sizeof( block_t ) );
     *pp_block = &p_fake->fake;



More information about the vlc-commits mailing list