lavc/videotoolboxenc: fix loadVTEncSymbols crash when symbol not found
authorjerett <wj.jiang@outlook.com>
Fri, 23 Jun 2017 12:57:18 +0000 (08:57 -0400)
committerRick Kern <kernrj@gmail.com>
Fri, 23 Jun 2017 13:37:34 +0000 (09:37 -0400)
Signed-off-by: Rick Kern <kernrj@gmail.com>
libavcodec/videotoolboxenc.c

index 638f278..7b901db 100644 (file)
@@ -73,11 +73,11 @@ static struct{
 
 #define GET_SYM(symbol, defaultVal)                                     \
 do{                                                                     \
-    CFStringRef cfstr = *(CFStringRef*)dlsym(RTLD_DEFAULT, #symbol);    \
-    if(!cfstr)                                                          \
+    CFStringRef* handle = (CFStringRef*)dlsym(RTLD_DEFAULT, #symbol);   \
+    if(!handle)                                                         \
         compat_keys.symbol = CFSTR(defaultVal);                         \
     else                                                                \
-        compat_keys.symbol = cfstr;                                     \
+        compat_keys.symbol = *handle;                                   \
 }while(0)
 
 static pthread_once_t once_ctrl = PTHREAD_ONCE_INIT;