[PATCH 3/3] notmuch-restore: allocate a temporary talloc context for each line parsed.
[notmuch-archives.git] / ab / 1ce4ecf65bf33d1555639525344a2dc5023aef
1 Return-Path: <tomi.ollila@iki.fi>\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 D3491431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 20:55:35 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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 9WDbOVWpV-3P for <notmuch@notmuchmail.org>;\r
16         Mon, 10 Dec 2012 20:55:35 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 43222431FAE\r
19         for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 20:55:35 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 3487D10007E;\r
22         Tue, 11 Dec 2012 06:55:31 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: david@tethera.net, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] _notmuch_message_index_file: unref (free) address lists\r
26         from gmime.\r
27 In-Reply-To: <1355196820-29734-1-git-send-email-david@tethera.net>\r
28 References: <1355188740-6663-1-git-send-email-david@tethera.net>\r
29         <1355196820-29734-1-git-send-email-david@tethera.net>\r
30 User-Agent: Notmuch/0.14+116~g29fcdb5 (http://notmuchmail.org) Emacs/24.2.1\r
31         (x86_64-unknown-linux-gnu)\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
33         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
34         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
35 Date: Tue, 11 Dec 2012 06:55:31 +0200\r
36 Message-ID: <m27gopfarg.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain\r
39 Cc: David Bremner <bremner@debian.org>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Tue, 11 Dec 2012 04:55:36 -0000\r
53 \r
54 On Tue, Dec 11 2012, david@tethera.net wrote:\r
55 \r
56 > From: David Bremner <bremner@debian.org>\r
57 >\r
58 > Apparently as of GMime 2.4, you don't need to call\r
59 > internet_address_list_destroy anymore, but you still need to call\r
60 > g_object_unref (from the GMime Changelog).\r
61 >\r
62 > On the medium performance corpus, valgrind shows "possibly lost"\r
63 > leakage in "notmuch new" dropping from 7M to 300k.\r
64 > ---\r
65 \r
66 LGTM.\r
67 \r
68 Tomi\r
69 \r
70 \r
71 >  lib/index.cc |   12 +++++++++---\r
72 >  1 file changed, 9 insertions(+), 3 deletions(-)\r
73 >\r
74 > diff --git a/lib/index.cc b/lib/index.cc\r
75 > index da0e6ce..a2edd6d 100644\r
76 > --- a/lib/index.cc\r
77 > +++ b/lib/index.cc\r
78 > @@ -484,12 +484,18 @@ mboxes is deprecated and may be removed in the future.\n", filename);\r
79 >      }\r
80 >  \r
81 >      from = g_mime_message_get_sender (mime_message);\r
82 > -    addresses = internet_address_list_parse_string (from);\r
83 >  \r
84 > -    _index_address_list (message, "from", addresses);\r
85 > +    addresses = internet_address_list_parse_string (from);\r
86 > +    if (addresses) {\r
87 > +     _index_address_list (message, "from", addresses);\r
88 > +     g_object_unref (addresses);\r
89 > +    }\r
90 >  \r
91 >      addresses = g_mime_message_get_all_recipients (mime_message);\r
92 > -    _index_address_list (message, "to", addresses);\r
93 > +    if (addresses) {\r
94 > +     _index_address_list (message, "to", addresses);\r
95 > +     g_object_unref (addresses);\r
96 > +    }\r
97 >  \r
98 >      subject = g_mime_message_get_subject (mime_message);\r
99 >      _notmuch_message_gen_terms (message, "subject", subject);\r
100 > -- \r
101 > 1.7.10.4\r
102 >\r
103 > _______________________________________________\r
104 > notmuch mailing list\r
105 > notmuch@notmuchmail.org\r
106 > http://notmuchmail.org/mailman/listinfo/notmuch\r