bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18145: memory leak in pwd


From: Pádraig Brady
Subject: bug#18145: memory leak in pwd
Date: Tue, 29 Jul 2014 12:55:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

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.
> 
> address@hidden 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]