[libadwaita/wip/sophie-h/pref-row-markup] Fix frees



commit 993f4a6994cc0e6de1224c26273fa7c5291e3604
Author: Sophie Herold <sophie hemio de>
Date:   Mon Apr 4 18:26:03 2022 +0200

    Fix frees

 src/adw-preferences-window.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/adw-preferences-window.c b/src/adw-preferences-window.c
index 0efbeb92..cc061e24 100644
--- a/src/adw-preferences-window.c
+++ b/src/adw-preferences-window.c
@@ -139,24 +139,23 @@ make_comparable (const char        *src,
   GError *error = NULL;
 
   if (adw_preferences_row_get_use_markup (row)) {
-    comparable = g_strdup (plaintext);
-    pango_parse_markup (comparable, -1, 0, NULL, &plaintext, NULL, &error);
-    free (comparable);
+    char* unparsed = g_strdup (plaintext);
+    pango_parse_markup (unparsed, -1, 0, NULL, &plaintext, NULL, &error);
+    free (unparsed);
 
-    g_assert_nonnull (error);
     if (error) {
-      free (error);
+      g_critical ("Couldn't parse markup: %s", error->message);
+      g_clear_error (&error);
     }
   }
 
   if (adw_preferences_row_get_use_underline (row) && allow_underline) {
     comparable = strip_mnemonic (plaintext);
+    free (plaintext);
   } else {
     comparable = plaintext;
   }
 
-  free (plaintext);
-
   return comparable;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]