avdevice/decklink: Fix segfault when running -list_devices on OSX
authorDevin Heitmueller <dheitmueller@ltnglobal.com>
Tue, 26 Sep 2017 16:06:20 +0000 (12:06 -0400)
committerMarton Balint <cus@passwd.hu>
Wed, 4 Oct 2017 20:48:23 +0000 (22:48 +0200)
The string is allocated with CFStringGetCString but was being
deallocated with free(), which would intermittently result in
a segmentation fault.  Use the correct function for freeing the
allocated CFString.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
libavdevice/decklink_common.cpp

index ff2df95..c782171 100644 (file)
@@ -84,7 +84,7 @@ static char *dup_cfstring_to_utf8(CFStringRef w)
 }
 #define DECKLINK_STR    const __CFString *
 #define DECKLINK_STRDUP dup_cfstring_to_utf8
-#define DECKLINK_FREE(s) free((void *) s)
+#define DECKLINK_FREE(s) CFRelease(s)
 #define DECKLINK_BOOL bool
 #else
 #define DECKLINK_STR    const char *