unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: notmuch@notmuchmail.org
Subject: [PATCH] lib/message-file: plug three memleaks.
Date: Mon,  9 May 2011 17:17:08 +0200	[thread overview]
Message-ID: <1304954228-22350-1-git-send-email-anton@khirnov.net> (raw)
In-Reply-To: <BANLkTikudNN6b53XfeTiSkQzUv1pouexTg@mail.gmail.com>

---
 lib/message-file.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 7722832..99505c1 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -341,12 +341,17 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
 		strncpy(combined_header,header_sofar,hdrsofar);
 		*(combined_header+hdrsofar) = ' ';
 		strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);
+		free (decoded_value);
 		g_hash_table_insert (message->headers, header, combined_header);
 	    }
 	} else {
 	    if (header_sofar == NULL) {
 		/* Only insert if we don't have a value for this header, yet. */
 		g_hash_table_insert (message->headers, header, decoded_value);
+	    } else {
+		free (header);
+		free (decoded_value);
+		decoded_value = header_sofar;
 	    }
 	}
 	/* if we found a match we can bail - unless of course we are
-- 
1.7.5.1

  reply	other threads:[~2011-05-09 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 14:43 [PATCH] lib/message-file: plug three memleaks Anton Khirnov
2011-05-09  6:46 ` Anton Khirnov
2011-05-09 12:42   ` Austin Clements
2011-05-09 15:17     ` Anton Khirnov [this message]
2011-05-09 17:01       ` Jameson Graef Rollins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304954228-22350-1-git-send-email-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).