[libadwaita/libadwaita-1-2] preferences-window: plug leak in make_comparable()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/libadwaita-1-2] preferences-window: plug leak in make_comparable()
- Date: Wed, 28 Sep 2022 04:51:06 +0000 (UTC)
commit 350998fb0819912dac180ca181b909eb4b1dc6f5
Author: Andy Holmes <andrew g r holmes gmail com>
Date: Sun Sep 25 14:25:25 2022 -0700
preferences-window: plug leak in make_comparable()
`pango_parse_markup()` is used to overwrite a pointer to an allocated
string. Since the input to this function is transfer-none and the
output is transfer-full, this leads to a leaked string.
See also GNOME/gi-docgen#141 for why this probably happened.
(cherry picked from commit 157aecac7b04b04b989da7bd763911ccfd498452)
src/adw-preferences-window.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-preferences-window.c b/src/adw-preferences-window.c
index 8fbe0e2f..f192a5e0 100644
--- a/src/adw-preferences-window.c
+++ b/src/adw-preferences-window.c
@@ -138,9 +138,12 @@ make_comparable (const char *src,
GError *error = NULL;
if (adw_preferences_row_get_use_markup (row)) {
- pango_parse_markup (plaintext, -1, 0, NULL, &plaintext, NULL, &error);
+ char *parsed = NULL;
- if (error) {
+ if (pango_parse_markup (plaintext, -1, 0, NULL, &parsed, NULL, &error)) {
+ g_free (plaintext);
+ plaintext = parsed;
+ } else {
g_critical ("Couldn't parse markup: %s", error->message);
g_clear_error (&error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]