From: Carl Worth <cworth@cworth.org>
To: Michael Forney <mforney@mforney.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH] lib: Fix memory leaks in notmuch_message_file_get_header
Date: Mon, 08 Nov 2010 09:19:49 -0800 [thread overview]
Message-ID: <877hgnohqi.fsf@yoom.home.cworth.org> (raw)
In-Reply-To: <1288928975-10041-1-git-send-email-mforney@mforney.org>
[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]
On Thu, 4 Nov 2010 20:49:35 -0700, Michael Forney <mforney@mforney.org> wrote:
> When decoded_value, header_sofar, and header are unused, they should
> be freed.
Thanks for the cleanups here. Just looking over the patch it's clear
that I let some code into message-file.c without coercing the style into
what I would really prefer to see, (should use talloc more, should move
away from overly-abbreviated identifiers such as "hdrsofar", and
shouldn't have ambiguously named identifiers such as "header_sofar" and
"hdrsofar").
> + free(decoded_value);
> + free(header_sofar);
> 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);
But I didn't push the change yet. The above do look like memory leak
fixes as described in the commit message.
> if (match && !is_received)
> - return decoded_value;
> + return header_sofar == NULL ? decoded_value : header_sofar;
> }
But this part looks like an independent bug fix that needs its own
description, (and perhaps a test case?). Could you please split the
patch into two?
Thanks,
-Carl
--
carl.d.worth@intel.com
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2010-11-08 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-05 3:49 [PATCH] lib: Fix memory leaks in notmuch_message_file_get_header Michael Forney
2010-11-08 17:19 ` Carl Worth [this message]
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=877hgnohqi.fsf@yoom.home.cworth.org \
--to=cworth@cworth.org \
--cc=mforney@mforney.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).