summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wagner <bungeman@chromium.org>2023-03-30 14:23:27 -0400
committerBen Wagner <bungeman@chromium.org>2023-03-30 14:23:57 -0400
commitec3e747d2fe874f265464bb83a5705df39e2003f (patch)
tree70b9e20d5a539f5daa8cc4682a6910a56653b374
parentc2666a6d9a6ed18b1bfcef8176e25f62993e24db (diff)
downloadfontconfig-ec3e747d2fe874f265464bb83a5705df39e2003f.tar.gz
Fix leak of `reason` in _FcConfigParse when not complaining
In "Do not return FcFalse from FcConfigParseAndLoad*() if complain is set to false" [0], _FcConfigParse was updated to return FcTrue early if it was instructed not to complain on errors. In "Take effect sysroot functionality to the default config file" [1] the error messages were factored into a `reason` which was allocated. Be sure to free this `reason` in the case of returning FcTrue early. Discovered with a leak checker while attempting to configure in interesting ways. [0] https://gitlab.freedesktop.org/fontconfig/fontconfig/-/commit/fcada522913e5e07efa6367eff87ace9f06d24c8 [1] https://gitlab.freedesktop.org/fontconfig/fontconfig/-/commit/cd51cb241aad7b362b793200ca7d42595c14f52b
-rw-r--r--src/fcxml.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fcxml.c b/src/fcxml.c
index c700f64..9fe0674 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -3689,7 +3689,10 @@ bail0:
if (realfilename)
FcStrFree (realfilename);
if (!complain)
+ {
+ FcStrBufDestroy (&reason);
return FcTrue;
+ }
if (!ret && complain_again)
{
if (name)