[vlc-commits] freetype: fix error handling in getPathForFontDescription

Marvin Scholz git at videolan.org
Wed Dec 4 11:33:00 CET 2019


vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Nov  7 00:43:09 2019 +0100| [119b5d417ebc3c2fcb03e4764a81f4bff650a62e] | committer: Marvin Scholz

freetype: fix error handling in getPathForFontDescription

(cherry picked from commit 40f90b7660140d551bbdc2cb4d07d0c1b1955d95)
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>

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

 modules/text_renderer/freetype/fonts/darwin.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/text_renderer/freetype/fonts/darwin.c b/modules/text_renderer/freetype/fonts/darwin.c
index 47a011eed0..5620f1f078 100644
--- a/modules/text_renderer/freetype/fonts/darwin.c
+++ b/modules/text_renderer/freetype/fonts/darwin.c
@@ -84,7 +84,13 @@ static char* CFStringCopyCString(CFStringRef cfString, CFStringEncoding cfString
 char* getPathForFontDescription(CTFontDescriptorRef fontDescriptor)
 {
     CFURLRef url = CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontURLAttribute);
+    if (url == NULL)
+        return NULL;
     CFStringRef path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
+    if (path == NULL) {
+        CFRelease(url);
+        return NULL;
+    }
     char *retPath = CFStringCopyCString(path, kCFStringEncodingUTF8);
     CFRelease(path);
     CFRelease(url);



More information about the vlc-commits mailing list