[tracker-miner-chatlog] observer: Plug some leaks



commit 88d62aceb823d4dd8e2ba4030ecb23d0b9708cca
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jan 17 20:23:40 2016 +0100

    observer: Plug some leaks
    
    We have to free the GMatchInfo, as well as the match.

 src/observer.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/observer.c b/src/observer.c
index e8542f0..26d9591 100644
--- a/src/observer.c
+++ b/src/observer.c
@@ -73,8 +73,10 @@ message_guess_recipients (TmcObserver *observer,
        GMatchInfo *match_info;
        gboolean first = TRUE;
 
-       if (!g_regex_match (priv->recipients_regex, text, 0, &match_info))
+       if (!g_regex_match (priv->recipients_regex, text, 0, &match_info)) {
+               g_match_info_free (match_info);
                return NULL;
+       }
 
        while (g_match_info_matches (match_info)) {
                TmcEntity *contact;
@@ -94,10 +96,14 @@ message_guess_recipients (TmcObserver *observer,
                                                           name);
                if (contact)
                        recipients = g_list_prepend (recipients, contact);
+
+               g_free (name);
        }
 
        /* FIXME: find pings to self on all the string */
 
+       g_match_info_free (match_info);
+
        return recipients;
 }
 


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