[vlc-commits] vlc_bits: fail on init if block allocation fails

Felix Paul Kühne git at videolan.org
Tue Feb 3 11:38:50 CET 2015


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Feb  3 11:38:09 2015 +0100| [d24751a730c8d352e7a45ea67c739ad8397a1418] | committer: Felix Paul Kühne

vlc_bits: fail on init if block allocation fails

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

 include/vlc_bits.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/vlc_bits.h b/include/vlc_bits.h
index 3b6e7c6..62e03a0 100644
--- a/include/vlc_bits.h
+++ b/include/vlc_bits.h
@@ -205,11 +205,16 @@ static inline void bs_align_1( bs_t *s )
     }
 }
 
-static inline void bo_init(bo_t *p_bo, int i_size)
+static inline int bo_init(bo_t *p_bo, int i_size)
 {
     p_bo->b = block_Alloc(i_size);
+    if (!p_bo->b)
+        return VLC_ENOMEM;
+
     p_bo->b->i_buffer = 0;
     p_bo->len = p_bo->basesize = i_size;
+
+    return VLC_SUCCESS;
 }
 
 static inline void bo_set_8(bo_t *p_bo, size_t i_offset, uint8_t i)



More information about the vlc-commits mailing list