[vlc-commits] videotoolbox: fix leak in ExtradataInfoCreate

Marvin Scholz git at videolan.org
Fri Jul 3 13:51:38 CEST 2020


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Fri Jul  3 01:20:49 2020 +0200| [51481f4eb32d926860a11ee6b26b5688c11b5d17] | committer: Marvin Scholz

videotoolbox: fix leak in ExtradataInfoCreate

If p_data is null, the already created extradataInfo was leaked.
Check p_data first and error out early to prevent even creating
the extradataInfo if its never used.

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

 modules/codec/videotoolbox.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/videotoolbox.c b/modules/codec/videotoolbox.c
index 4a0912cb08..30d3d330ac 100644
--- a/modules/codec/videotoolbox.c
+++ b/modules/codec/videotoolbox.c
@@ -1627,11 +1627,11 @@ static int ConfigureVout(decoder_t *p_dec)
 static CFMutableDictionaryRef ExtradataInfoCreate(CFStringRef name,
                                                   void *p_data, size_t i_data)
 {
-    CFMutableDictionaryRef extradataInfo = cfdict_create(1);
-    if (extradataInfo == NULL)
+    if (p_data == NULL)
         return NULL;
 
-    if (p_data == NULL)
+    CFMutableDictionaryRef extradataInfo = cfdict_create(1);
+    if (extradataInfo == NULL)
         return NULL;
 
     CFDataRef extradata = CFDataCreate(kCFAllocatorDefault, p_data, i_data);



More information about the vlc-commits mailing list