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

Marvin Scholz git at videolan.org
Mon Nov 18 15:34:43 CET 2019


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Nov  7 00:43:09 2019 +0100| [40f90b7660140d551bbdc2cb4d07d0c1b1955d95] | committer: Marvin Scholz

freetype: fix error handling in getPathForFontDescription

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

 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 cf7a90c94a..3b91284272 100644
--- a/modules/text_renderer/freetype/fonts/darwin.c
+++ b/modules/text_renderer/freetype/fonts/darwin.c
@@ -46,7 +46,13 @@ void addNewFontToFamily(filter_t *p_filter, CTFontDescriptorRef iter, char *path
 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 = FromCFString(path, kCFStringEncodingUTF8);
     CFRelease(path);
     CFRelease(url);



More information about the vlc-commits mailing list