unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: david@tethera.net
To: notmuch@notmuchmail.org
Cc: David Bremner <bremner@debian.org>
Subject: [PATCH] notmuch_message_file_get_header: replace free with g_free
Date: Mon, 10 Dec 2012 21:19:00 -0400	[thread overview]
Message-ID: <1355188740-6663-1-git-send-email-david@tethera.net> (raw)

From: David Bremner <bremner@debian.org>

The pointer returned by g_mime_utils_header_decode_text is from the
following line in rfc2047_decode_tokens

	return g_string_free (decoded, FALSE);

The docs for g_string_free say

 Frees the memory allocated for the GString. If free_segment is TRUE
 it also frees the character data. If it's FALSE, the caller gains
 ownership of the buffer and must free it after use with g_free().
---
 lib/message-file.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 915aba8..976769d 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -341,7 +341,7 @@ 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_free (decoded_value);
 		g_hash_table_insert (message->headers, header, combined_header);
 	    }
 	} else {
@@ -350,7 +350,7 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
 		g_hash_table_insert (message->headers, header, decoded_value);
 	    } else {
 		free (header);
-		free (decoded_value);
+		g_free (decoded_value);
 		decoded_value = header_sofar;
 	    }
 	}
-- 
1.7.10.4

             reply	other threads:[~2012-12-11  1:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11  1:19 david [this message]
2012-12-11  3:33 ` [PATCH] _notmuch_message_index_file: unref (free) address lists from gmime david
2012-12-11  4:55   ` Tomi Ollila
2012-12-24 20:32   ` Austin Clements
2012-12-24 23:06   ` David Bremner
2012-12-11  4:50 ` [PATCH] notmuch_message_file_get_header: replace free with g_free Tomi Ollila

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=1355188740-6663-1-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=bremner@debian.org \
    --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).