[vlc-commits] videotoolbox: Fix early buffer deallocation

Maxime CHAPELET git at videolan.org
Thu Oct 20 13:02:21 CEST 2016


vlc | branch: master | Maxime CHAPELET <maxime.chapelet at giroptic.com> | Thu Oct 20 12:59:57 2016 +0200| [48709b125e98e5896eab513f312a24e05d172d4c] | committer: Francois Cartegnie

videotoolbox: Fix early buffer deallocation

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

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

 modules/codec/videotoolbox.m | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index e18bc8b..f105f39 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -420,9 +420,8 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
                                       &p_sps_nal, &i_sps_nalsize,
                                       &p_pps_nal, &i_pps_nalsize,
                                       NULL, NULL) ? VLC_SUCCESS : VLC_EGENERIC;
-        if(p_alloc_buf)
-            free(p_alloc_buf);
         if (i_ret != VLC_SUCCESS) {
+            free(p_alloc_buf);
             msg_Warn(p_dec, "sps pps detection failed");
             return VLC_EGENERIC;
         }
@@ -433,6 +432,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
             h264_sequence_parameter_set_t *p_sps_data;
             if( !( p_sps_data = h264_decode_sps(p_sps_nal, i_sps_nalsize, true) ) )
             {
+                free(p_alloc_buf);
                 msg_Warn(p_dec, "sps pps parsing failed");
                 return VLC_EGENERIC;
             }
@@ -474,6 +474,8 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
                                      p_dec->fmt_in.i_extra);
         }
 
+        free(p_alloc_buf);
+
         if (extradata)
             CFDictionarySetValue(extradata_info, CFSTR("avcC"), extradata);
 



More information about the vlc-commits mailing list