diff options
author | Ben Wagner <bungeman@chromium.org> | 2023-03-30 14:23:27 -0400 |
---|---|---|
committer | Ben Wagner <bungeman@chromium.org> | 2023-03-30 14:23:57 -0400 |
commit | ec3e747d2fe874f265464bb83a5705df39e2003f (patch) | |
tree | 70b9e20d5a539f5daa8cc4682a6910a56653b374 | |
parent | c2666a6d9a6ed18b1bfcef8176e25f62993e24db (diff) | |
download | fontconfig-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.c | 3 |
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) |