[balsa] mime: Do not leak GMatchInfo



commit 5ebb7414eb2bde1a5e13ebab24d82132763200c6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon May 16 18:42:35 2022 -0400

    mime: Do not leak GMatchInfo

 libbalsa/mime.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/libbalsa/mime.c b/libbalsa/mime.c
index b02d4cb64..2dab9f784 100644
--- a/libbalsa/mime.c
+++ b/libbalsa/mime.c
@@ -803,6 +803,7 @@ libbalsa_insert_with_url(GtkTextBuffer * buffer,
     match = g_regex_match(url_reg, chars, 0, &url_match)
         && g_match_info_fetch_pos(url_match, 0, &start_pos, &end_pos)
         && chars + start_pos < line_end;
+    g_match_info_free(url_match);
 
     while (match) {
         gchar *spc;
@@ -879,15 +880,15 @@ libbalsa_insert_with_url(GtkTextBuffer * buffer,
 
         chars += end_pos;
         if (prescanner(chars, line_end - chars)) {
-            g_match_info_free(url_match);
             match = g_regex_match(url_reg, chars, 0, &url_match)
                 && g_match_info_fetch_pos(url_match, 0, &start_pos,
                                           &end_pos)
                 && chars + start_pos < line_end;
-        } else
+            g_match_info_free(url_match);
+        } else {
             match = FALSE;
+        }
     }
-    g_match_info_free(url_match);
 
     gtk_text_buffer_insert_with_tags(buffer, &iter, chars,
                                      line_end - chars, tag, NULL);


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