diff options
author | Albert Astals Cid <aacid@kde.org> | 2021-03-31 22:11:31 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2021-04-10 00:10:20 +0200 |
commit | fd3eebad741c0fdfce2a7e44f9b3ac8895b70a58 (patch) | |
tree | 35e253bd6b24b55eafe18f8e07d8b0634db28a39 | |
parent | 6f27f42e6140030715075aa3bd3e5cc9e2fdc6f1 (diff) |
Fix potential memory leak in _get_real_paths_from_prefix
-rw-r--r-- | src/fcxml.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/fcxml.c b/src/fcxml.c index 0db318c..83019c0 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -1299,12 +1299,17 @@ _get_real_paths_from_prefix(FcConfigParse *parse, const FcChar8 *path, const FcC if (FcStrCmp (prefix, (const FcChar8 *) "xdg") == 0) { parent = FcConfigXdgDataHome (); - e = FcConfigXdgDataDirs (); - if (!parent || !e) + if (!parent) { /* Home directory might be disabled */ return NULL; } + e = FcConfigXdgDataDirs (); + if (!e) + { + FcStrFree (parent); + return NULL; + } } else if (FcStrCmp (prefix, (const FcChar8 *) "default") == 0 || FcStrCmp (prefix, (const FcChar8 *) "cwd") == 0) |