[vlc-commits] packetizer: hevc/h264: set result size to 0 on alloc failure

Francois Cartegnie git at videolan.org
Sat Dec 12 23:20:16 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Dec 12 19:41:03 2015 +0100| [b7ae513635e02c5c50f51c6c9b0c1e4e0d976351] | committer: Francois Cartegnie

packetizer: hevc/h264: set result size to 0 on alloc failure

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

 modules/packetizer/h264_nal.c |    3 +++
 modules/packetizer/hevc_nal.c |    3 +++
 2 files changed, 6 insertions(+)

diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index e2bfdbb..979e81e 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -82,7 +82,10 @@ uint8_t *h264_avcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
     uint8_t *p_ret;
     uint8_t *p_out_buf = p_ret = malloc( *pi_result );
     if( !p_out_buf )
+    {
+        *pi_result = 0;
         return NULL;
+    }
 
     p_buf += 5;
 
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 95ab63b..9e301f1 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -77,7 +77,10 @@ uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
     uint8_t *p_ret;
     uint8_t *p_out_buf = p_ret = malloc( *pi_result );
     if( !p_out_buf )
+    {
+        *pi_result = 0;
         return NULL;
+    }
 
     const uint8_t i_num_array = p_buf[22];
     p_buf += 23;



More information about the vlc-commits mailing list