[balsa] mailbox_local: Do not leak reference to message



commit 58a5fc4a04005d2bde7094d42b480ae486000057
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon May 16 18:44:40 2022 -0400

    mailbox_local: Do not leak reference to message

 libbalsa/mailbox_local.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index c4e246973..942df72d9 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -853,12 +853,17 @@ message_match_real(LibBalsaMailbox *mailbox, guint msgno,
         lbm_local_cache_message(local, msgno, message);
         entry = libbalsa_mailbox_get_index_entry(mailbox, msgno);
         info  = g_ptr_array_index(priv->threading_info, msgno - 1);
-        if (entry == NULL || info == NULL)
+        if (entry == NULL || info == NULL) {
+            g_object_unref(message);
             return FALSE;
+        }
     }
 
-    if (entry->idle_pending)
+    if (entry->idle_pending) {
+        if (message != NULL)
+            g_object_unref(message);
         return FALSE;   /* Can't match. */
+    }
 
     switch (cond->type) {
     case CONDITION_STRING:


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