1 Return-Path: <tomi.ollila@nixu.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 7EB0B431FD0
\r
6 for <notmuch@notmuchmail.org>; Wed, 7 Dec 2011 13:29:57 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id fWRDlWxj6Dq4 for <notmuch@notmuchmail.org>;
\r
16 Wed, 7 Dec 2011 13:29:56 -0800 (PST)
\r
17 Received: from mail-gw3.nixu.fi (mail-gw3.nixu.fi [193.209.237.7])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 92C2B431FB6
\r
21 for <notmuch@notmuchmail.org>; Wed, 7 Dec 2011 13:29:56 -0800 (PST)
\r
22 Received: from pps.filterd (mail-gw3 [127.0.0.1])
\r
23 by mail-gw3.nixu.fi (8.14.4/8.14.4) with SMTP id pB7LQPGt031713
\r
24 for <notmuch@notmuchmail.org>; Wed, 7 Dec 2011 23:29:54 +0200
\r
25 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])
\r
26 by mail-gw3.nixu.fi with ESMTP id 114cs0r8js-1
\r
27 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT)
\r
28 for <notmuch@notmuchmail.org>; Wed, 07 Dec 2011 23:29:54 +0200
\r
29 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])
\r
30 by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id
\r
32 for <notmuch@notmuchmail.org>; Wed, 7 Dec 2011 23:29:53 +0200
\r
33 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: Re: [PATCH] Release memory allocated by
\r
36 internet_address_list_parse_string()
\r
37 In-Reply-To: <yf61usgywbk.fsf@taco2.nixu.fi>
\r
38 References: <yf61usgywbk.fsf@taco2.nixu.fi>
\r
39 User-Agent: Notmuch/0.10.2+70~gf0e0053 (http://notmuchmail.org) Emacs/23.3.1
\r
41 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
42 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
43 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
44 Date: Wed, 07 Dec 2011 23:29:52 +0200
\r
45 Message-ID: <yf61usgul2n.fsf@taco2.nixu.fi>
\r
47 Content-Type: text/plain; charset=us-ascii
\r
48 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110,
\r
49 1.0.211, 0.0.0000 definitions=2011-12-07_07:2011-12-07, 2011-12-07,
\r
50 1970-01-01 signatures=0
\r
51 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
\r
52 ipscore=0 suspectscore=3
\r
53 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0
\r
55 scancount=1 engine=6.0.2-1012030000 definitions=main-1112070210
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.13
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Wed, 07 Dec 2011 21:29:57 -0000
\r
70 On Wed, 07 Dec 2011 22:13:19 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
71 > g_object_unref() releases the memory of the InternetAddressList object
\r
72 > returned by internet_address_list_parse_string() -- when last (only)
\r
73 > reference is released, internet_address_list_finalize() will do cleanup.
\r
75 > When reviewing, see also gmime-2.4.25/gmime/internet-address.c (or older)
\r
76 > I tested this patch by entering: notmuch show --format=mbox '*' | wc
\r
78 > Note that this fixes one potential memory leak only in case --format=mbox
\r
79 > as _extract_email_address is called only there.
\r
81 There is at least one bug here -- I failed to check whether addresses
\r
82 is non-NULL before attempting to g_object_unref (). So please ignore
\r
83 that when reviewing whether g_object_unref() is the correct action here.
\r
85 I provide a new patch when I know whether re-check or separate the
\r
86 NULL test in the beginning of _extract_email_address().
\r
88 > notmuch-show.c | 2 +-
\r
89 > 1 files changed, 1 insertions(+), 1 deletions(-)
\r
91 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
92 > index 603992a..3abfa07 100644
\r
93 > --- a/notmuch-show.c
\r
94 > +++ b/notmuch-show.c
\r
95 > @@ -255,7 +255,7 @@ _extract_email_address (const void *ctx, const char *from)
\r
96 > email = talloc_strdup (ctx, email);
\r
99 > - /* XXX: How to free addresses here? */
\r
100 > + g_object_unref (addresses);
\r