From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 29 07:08:52 2014 Received: (at submit) by debbugs.gnu.org; 29 Jul 2014 11:08:52 +0000 Received: from localhost ([127.0.0.1]:41669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC5Gx-0003h2-5f for submit@debbugs.gnu.org; Tue, 29 Jul 2014 07:08:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33823) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC1QM-0005y2-FJ for submit@debbugs.gnu.org; Tue, 29 Jul 2014 03:02:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC1QG-0001tb-9M for submit@debbugs.gnu.org; Tue, 29 Jul 2014 03:02:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC1QG-0001tW-6A for submit@debbugs.gnu.org; Tue, 29 Jul 2014 03:02:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC1QF-0000LD-7n for bug-coreutils@gnu.org; Tue, 29 Jul 2014 03:02:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC1QE-0001sg-BD for bug-coreutils@gnu.org; Tue, 29 Jul 2014 03:02:07 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:53556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC1QE-0001sH-3n for bug-coreutils@gnu.org; Tue, 29 Jul 2014 03:02:06 -0400 Received: by mail-wi0-f177.google.com with SMTP id ho1so427775wib.4 for ; Tue, 29 Jul 2014 00:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=wnTyoX8nUenNuNe4ViceSNVFrkvgCa9dMknSoTjkDmQ=; b=HBSuGqMwtRqcS10NMvdiWeSCzrPeXn+6iU1vf8zQMjvRJAr5fy5sTeRC2zjoni+2XF c+PBFLpqVsBrraFETJuC3YVe3DfgnToXiZVLT4efcq0Cwn+cyRGnSpsLu27Xj4J3/YKl GrW/ZM61LIJoHe5RIW4gpfJAKZRR2dUi+kl8KZma44QDbz8wObP1SIIOZ6oNSiAyI7pY WLFIecqpoCwCoeEKAc1Q8nzTnH2HWeOhr6/Qcqb9KydaDnRy2ZNu9gqb2nijoej220Lb DpA+8w6vQcyTSA/OjPKyX608htrz/xKbNmdZH2IDx3FyhvuKnhmiZ/F/dnkSZEsQoTda XqvA== MIME-Version: 1.0 X-Received: by 10.180.210.172 with SMTP id mv12mr37960338wic.14.1406617324230; Tue, 29 Jul 2014 00:02:04 -0700 (PDT) Received: by 10.194.91.232 with HTTP; Tue, 29 Jul 2014 00:02:04 -0700 (PDT) Date: Tue, 29 Jul 2014 12:32:04 +0530 Message-ID: Subject: memory leak in pwd From: srinivas devaki To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary=001a11c37edef21fe904ff4f9daf X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 29 Jul 2014 07:08:44 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --001a11c37edef21fe904ff4f9daf Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable i think there is a memory leak in pwd.c I=E2=80=99m extremely sorry if this is wrong. I=E2=80=99m sending the git d= iff. [eightnoteight@mr coreutils]$ git diff diff --git a/src/pwd.c b/src/pwd.c index 4993dfb..13d84cd 100644 --- a/src/pwd.c +++ b/src/pwd.c @@ -367,6 +367,7 @@ main (int argc, char **argv) if (wd) { puts (wd); + free (wd); exit (EXIT_SUCCESS); } } and how can i contribute to gnu coreutils. how can i understand the code of utils. which libraries should i get used to, before contributing to the gnu coreutils. Thanks ! =E2=80=8B --001a11c37edef21fe904ff4f9daf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

i think there is a memory leak in pwd.c
I=E2=80= =99m extremely sorry if this is wrong. I=E2=80=99m sending the git diff.

[eightnoteight@mr coreutils]$ git diff
diff --git a/src/pwd.c b/src/pwd.c
index 4993dfb..13d84cd 100644
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -367,6 +367,7 @@ main (int argc, char **argv)
       if (wd)
         {
           puts (wd);
+          free (wd);
           exit (EXIT_SUCCESS);
         }
     }

and how can i contribu= te to gnu coreutils. how can i understand the code of utils. which librarie= s should i get used to, before contributing to the gnu coreutils.

Thanks !

=E2=80=8B
--001a11c37edef21fe904ff4f9daf-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 29 07:55:39 2014 Received: (at 18145) by debbugs.gnu.org; 29 Jul 2014 11:55:39 +0000 Received: from localhost ([127.0.0.1]:41705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC60F-00060v-6C for submit@debbugs.gnu.org; Tue, 29 Jul 2014 07:55:39 -0400 Received: from mail6.vodafone.ie ([213.233.128.184]:29682) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC609-00060d-4A for 18145@debbugs.gnu.org; Tue, 29 Jul 2014 07:55:33 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvQCAK+K11NtTcXG/2dsb2JhbAANTINgVwGCd8h3h0kBgSSEewEBBCMPAUYQCw0LAgIFFgsCAgkDAgECAUUGDQEHAQGIQwimMHeXVBeBLI4gB4J5gVEFoxOQUWwB Received: from unknown (HELO [192.168.1.79]) ([109.77.197.198]) by mail3.vodafone.ie with ESMTP; 29 Jul 2014 12:55:22 +0100 Message-ID: <53D78BA9.4070901@draigBrady.com> Date: Tue, 29 Jul 2014 12:55:21 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: srinivas devaki Subject: Re: bug#18145: memory leak in pwd References: In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18145 Cc: 18145@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tag 18145 notabug close 18145 stop On 07/29/2014 08:02 AM, srinivas devaki wrote: > i think there is a memory leak in pwd.c > I’m extremely sorry if this is wrong. I’m sending the git diff. > > [eightnoteight@mr coreutils]$ git diff > diff --git a/src/pwd.c b/src/pwd.c > index 4993dfb..13d84cd 100644 > --- a/src/pwd.c > +++ b/src/pwd.c > @@ -367,6 +367,7 @@ main (int argc, char **argv) > if (wd) > { > puts (wd); > + free (wd); > exit (EXIT_SUCCESS); > } > } > > and how can i contribute to gnu coreutils. how can i understand the code of > utils. which libraries should i get used to, before contributing to the gnu > coreutils. valgrind doesn't concur: $ valgrind src/pwd -L ==30954== All heap blocks were freed -- no leaks are possible You can see that logical_getcwd() doesn't allocate, so no free is necessary. On the general point of coreutils dev there is: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=README-hacking;hb=HEAD thanks, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 29 07:56:04 2014 Received: (at control) by debbugs.gnu.org; 29 Jul 2014 11:56:04 +0000 Received: from localhost ([127.0.0.1]:41708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC60c-00061Z-Vh for submit@debbugs.gnu.org; Tue, 29 Jul 2014 07:56:04 -0400 Received: from mail5.vodafone.ie ([213.233.128.176]:48953) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XC60V-00061D-Ag for control@debbugs.gnu.org; Tue, 29 Jul 2014 07:55:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgCAK+K11NtTcXG/2dsb2JhbAANTIQagxWKMKZqnx0yfIUaCipUDQIFFgsCCwMCAQIBOQYCAhUIAQGIQ6Y4d5dUF4Esjj2CY4FRBaMTkFE Received: from unknown (HELO [192.168.1.79]) ([109.77.197.198]) by mail3.vodafone.ie with ESMTP; 29 Jul 2014 12:55:45 +0100 Message-ID: <53D78BC1.9020807@draigBrady.com> Date: Tue, 29 Jul 2014 12:55:45 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: control@debbugs.gnu.org X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tag 18145 notabug close 18145 stop [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tag 18145 notabug close 18145 stop [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject tag 18145 notabug close 18145 stop From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 01 13:12:09 2014 Received: (at 18145) by debbugs.gnu.org; 1 Aug 2014 17:12:09 +0000 Received: from localhost ([127.0.0.1]:54105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XDGNE-0007Io-WB for submit@debbugs.gnu.org; Fri, 01 Aug 2014 13:12:09 -0400 Received: from joseki.proulx.com ([216.17.153.58]:52541) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XDGNC-0007Ie-Ba for 18145@debbugs.gnu.org; Fri, 01 Aug 2014 13:12:07 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id EF3EC21835; Fri, 1 Aug 2014 11:12:04 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id D02A32DC3A; Fri, 1 Aug 2014 11:12:04 -0600 (MDT) Date: Fri, 1 Aug 2014 11:12:04 -0600 From: Bob Proulx To: srinivas devaki , 18145@debbugs.gnu.org Subject: Re: bug#18145: memory leak in pwd Message-ID: <20140801110900425898368@bob.proulx.com> References: <53D78BA9.4070901@draigBrady.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <53D78BA9.4070901@draigBrady.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18145 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) srinivas devaki wrote: > i think there is a memory leak in pwd.c > I’m extremely sorry if this is wrong. I’m sending the git diff. > + free (wd); > exit (EXIT_SUCCESS); There is never a need to free memory before exiting from a program. All work being done to free up the memory, coalesce memory blocks, list memory blocks in a free list, and so forth is completely unnecessary power that is wasted. Think of the heat and battery life wasted by doing this across zillions of devices. Upon exit all resources are freed as the program evaporates. Bob From unknown Sun Aug 17 22:09:55 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 30 Aug 2014 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator