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 D5B5B431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 7 Feb 2012 00:34:27 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 6wZRtckBnmTc for <notmuch@notmuchmail.org>;
\r
17 Tue, 7 Feb 2012 00:34:27 -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 C199C431FAE
\r
22 for <notmuch@notmuchmail.org>; Tue, 7 Feb 2012 00:34:26 -0800 (PST)
\r
23 Received: by bke11 with SMTP id 11so6228204bke.26
\r
24 for <notmuch@notmuchmail.org>; Tue, 07 Feb 2012 00:34:25 -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=XWvVEsew+3MQRJA+TjhueiSyWOV0QNnhiVO1YF/QOGc=;
\r
29 b=H5/D33/rgpGEWikmvIPOtrHJxnjvO8/ii/nDK5g1RGK/4MeXFnCR38amQRHjVGunSP
\r
30 D8O8yEOfJf9qD2qj4DIADwsEQIF0pIw8BrZEC65cUGxoZFt143lw9DjMzZVZjdv/urYI
\r
31 rP+YMiKPFNNA9E3NxKhqfC5ysV/h3/zP3vA8Y=
\r
32 Received: by 10.205.133.196 with SMTP id hz4mr3033097bkc.71.1328603664719;
\r
33 Tue, 07 Feb 2012 00:34:24 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id bw9sm53347216bkb.8.2012.02.07.00.34.23
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Tue, 07 Feb 2012 00:34:23 -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 v2] Free the results of scandir()
\r
41 In-Reply-To: <1328597405-6437-1-git-send-email-glasse@cs.rpi.edu>
\r
42 References: <1328597405-6437-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 12:33:08 +0400
\r
46 Message-ID: <871uq7yrej.fsf@gmail.com>
\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
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 08:34:28 -0000
\r
66 On Tue, 7 Feb 2012 01:50:05 -0500, Ethan Glasser-Camp <glasse@cs.rpi.edu> wrote:
\r
67 > From: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
69 > scandir() returns "strings allocated via malloc(3)" which are then
\r
70 > "collected in array namelist which is allocated via
\r
71 > malloc(3)". Currently we just free the array namelist. Instead, free
\r
72 > all the entries of namelist, and then free namelist.
\r
74 > entry only points to elements of namelist, so we don't free it
\r
78 > Fixes the other use of scandir in count_files. Thanks, Jani.
\r
81 Few style comments below. Otherwise looks good.
\r
83 > notmuch-new.c | 16 ++++++++++------
\r
84 > 1 files changed, 10 insertions(+), 6 deletions(-)
\r
86 > diff --git a/notmuch-new.c b/notmuch-new.c
\r
87 > index a569a54..e62560b 100644
\r
88 > --- a/notmuch-new.c
\r
89 > +++ b/notmuch-new.c
\r
90 > @@ -559,12 +559,14 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
93 > talloc_free (next);
\r
99 > + if (fs_entries){
\r
101 Please add a space before '{'.
\r
103 > + for (i = 0; i < num_fs_entries; i++){
\r
104 > + free (fs_entries[i]);
\r
107 Please remove "{}" around one line block.
\r
109 > free (fs_entries);
\r
112 > notmuch_filenames_destroy (db_subdirs);
\r
114 > @@ -704,10 +706,12 @@ count_files (const char *path, int *count)
\r
120 > - if (fs_entries)
\r
121 > + if (fs_entries){
\r
122 > + for (i = 0; i < num_fs_entries; i++){
\r
123 > + free (fs_entries[i]);
\r
126 Same two comments here.
\r
131 > free (fs_entries);
\r
139 > _______________________________________________
\r
140 > notmuch mailing list
\r
141 > notmuch@notmuchmail.org
\r
142 > http://notmuchmail.org/mailman/listinfo/notmuch
\r