Re: Applying patches directly from emails?
[notmuch-archives.git] / 54 / cf926974d7634ed3a18f0c3e267c601993c040
1 Return-Path: <dmitry.kurochkin@gmail.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 17B67431FB6\r
6         for <notmuch@notmuchmail.org>; Tue,  7 Feb 2012 02:12:11 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id fcB5ddDOzYAl for <notmuch@notmuchmail.org>;\r
17         Tue,  7 Feb 2012 02:12:10 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 455DB431FAE\r
22         for <notmuch@notmuchmail.org>; Tue,  7 Feb 2012 02:12:10 -0800 (PST)\r
23 Received: by bke11 with SMTP id 11so6307784bke.26\r
24         for <notmuch@notmuchmail.org>; Tue, 07 Feb 2012 02:12:08 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type;\r
28         bh=IjOAF5+bAiHOlY5uM6/2HoOgp7zuPam7qRQxCcy2UCE=;\r
29         b=mW5udbxRZBjo9WZg3VxaKMd+bWe3OETrIQ39qdSCOI2h8ThJTovwajW054meDdFa1f\r
30         MmZzRtMe9zJ4qfnaksQPLIaN3KG1ytHymNoWdO5vfuo6MOCTQj2Ruz4NS1o8jQN9s4Nh\r
31         K5rHWIpXzts2u0BVLg1Zp3IA6L7owvKySR98Y=\r
32 Received: by 10.204.157.17 with SMTP id z17mr9959543bkw.37.1328609528838;\r
33         Tue, 07 Feb 2012 02:12:08 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id w15sm13223841bku.0.2012.02.07.02.12.07\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Tue, 07 Feb 2012 02:12:08 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Ethan Glasser-Camp <glasse@cs.rpi.edu>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH] Free the results of scandir()\r
41 In-Reply-To: <1328609103-7870-1-git-send-email-glasse@cs.rpi.edu>\r
42 References: <1328609103-7870-1-git-send-email-glasse@cs.rpi.edu>\r
43 User-Agent: Notmuch/0.11+139~gd9b7cab (http://notmuchmail.org) Emacs/23.3.1\r
44         (x86_64-pc-linux-gnu)\r
45 Date: Tue, 07 Feb 2012 14:10:52 +0400\r
46 Message-ID: <87vcnjx8b7.fsf@gmail.com>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=us-ascii\r
49 Cc: Ethan Glasser-Camp <ethan@betacantrips.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Tue, 07 Feb 2012 10:12:11 -0000\r
63 \r
64 On Tue,  7 Feb 2012 05:05:03 -0500, Ethan Glasser-Camp <glasse@cs.rpi.edu> wrote:\r
65 > From: Ethan Glasser-Camp <ethan@betacantrips.com>\r
66\r
67 > scandir() returns "strings allocated via malloc(3)" which are then\r
68 > "collected in array namelist which is allocated via\r
69 > malloc(3)". Currently we just free the array namelist. Instead, free\r
70 > all the entries of namelist, and then free namelist.\r
71\r
72 > entry only points to elements of namelist, so we don't free it\r
73 > separately.\r
74 > ---\r
75\r
76 > v3: I'm still learning the house style. Thanks Dmitry.\r
77\r
78 \r
79 Looks good.\r
80 \r
81 Please use --subject-prefix='PATCH vN' parameter when sending new\r
82 versions of patches.  Also, sending new versions as replies to the first\r
83 email in the original thread makes it easier to track.\r
84 \r
85 Regards,\r
86   Dmitry\r
87 \r
88 >  notmuch-new.c |   16 ++++++++++------\r
89 >  1 files changed, 10 insertions(+), 6 deletions(-)\r
90\r
91 > diff --git a/notmuch-new.c b/notmuch-new.c\r
92 > index a569a54..8dbebb3 100644\r
93 > --- a/notmuch-new.c\r
94 > +++ b/notmuch-new.c\r
95 > @@ -559,12 +559,14 @@ add_files_recursive (notmuch_database_t *notmuch,\r
96 >    DONE:\r
97 >      if (next)\r
98 >       talloc_free (next);\r
99 > -    if (entry)\r
100 > -     free (entry);\r
101 >      if (dir)\r
102 >       closedir (dir);\r
103 > -    if (fs_entries)\r
104 > +    if (fs_entries) {\r
105 > +     for (i = 0; i < num_fs_entries; i++)\r
106 > +         free (fs_entries[i]);\r
107 > +\r
108 >       free (fs_entries);\r
109 > +    }\r
110 >      if (db_subdirs)\r
111 >       notmuch_filenames_destroy (db_subdirs);\r
112 >      if (db_files)\r
113 > @@ -704,10 +706,12 @@ count_files (const char *path, int *count)\r
114 >      }\r
115 >  \r
116 >    DONE:\r
117 > -    if (entry)\r
118 > -     free (entry);\r
119 > -    if (fs_entries)\r
120 > +    if (fs_entries) {\r
121 > +     for (i = 0; i < num_fs_entries; i++)\r
122 > +         free (fs_entries[i]);\r
123 > +\r
124 >          free (fs_entries);\r
125 > +    }\r
126 >  }\r
127 >  \r
128 >  static void\r
129 > -- \r
130 > 1.7.5.4\r
131\r
132 > _______________________________________________\r
133 > notmuch mailing list\r
134 > notmuch@notmuchmail.org\r
135 > http://notmuchmail.org/mailman/listinfo/notmuch\r