[balsa/wip/gmime3] imap-handle.c: Do not leak ImapEnvelope.



commit 2c96d68b799670dce1f60f13297f9c649b9b28a8
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu May 31 19:23:45 2018 -0400

    imap-handle.c: Do not leak ImapEnvelope.
    
    * libbalsa/imap/imap-handle.c (ir_body_type_1part): Do not leak
      ImapEnvelope.

 ChangeLog                   |  5 +++++
 libbalsa/imap/imap-handle.c | 16 ++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index de146570d..0bd0651e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-31  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       * libbalsa/imap/imap-handle.c (ir_body_type_1part): Do not leak
+       ImapEnvelope.
+
 2018-05-31  Albrecht Dreß <albrecht dress arcor de>
 
        Mitigate EFail vulnerability for Webkit2
diff --git a/libbalsa/imap/imap-handle.c b/libbalsa/imap/imap-handle.c
index f1de59c1a..d1c4dfdeb 100644
--- a/libbalsa/imap/imap-handle.c
+++ b/libbalsa/imap/imap-handle.c
@@ -3983,7 +3983,11 @@ ir_body_type_1part (struct siobuf *sio, ImapBody * body,
       rc = ir_envelope (sio, env);
 #if GMAIL_BUG_20100725
       if (rc == IMR_PARSE)
+        {
+         if (env)
+           imap_envelope_free (env);
           break;
+        }
 #endif /* GMAIL_BUG_20100725 */
       if (rc != IMR_OK)
        {
@@ -3992,14 +3996,22 @@ ir_body_type_1part (struct siobuf *sio, ImapBody * body,
          return rc;
        }
       if (sio_getc (sio) != ' ')
-        return IMR_PROTOCOL;
+       {
+          if (env)
+            imap_envelope_free (env);
+          return IMR_PROTOCOL;
+       }
       if (body)
        {
          b = imap_body_new ();
          body->envelope = env;
        }
       else
-       b = NULL;
+        {
+         b = NULL;
+         if (env)
+           imap_envelope_free (env);
+        }
       rc = ir_body (sio, sio_getc (sio), b, type);
       if (body)
        imap_body_append_child (body, b);


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