GNU bug report logs -
#18145
memory leak in pwd
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18145 in the body.
You can then email your comments to 18145 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#18145
; Package
coreutils
.
(Tue, 29 Jul 2014 11:09:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
srinivas devaki <mr.eightnoteight <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Tue, 29 Jul 2014 11:09:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 <at> 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 !
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#18145
; Package
coreutils
.
(Tue, 29 Jul 2014 11:56:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 18145 <at> debbugs.gnu.org (full text, mbox):
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 <at> 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.
Added tag(s) notabug.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Tue, 29 Jul 2014 11:57:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
18145 <at> debbugs.gnu.org and srinivas devaki <mr.eightnoteight <at> gmail.com>
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Tue, 29 Jul 2014 11:57:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#18145
; Package
coreutils
.
(Fri, 01 Aug 2014 17:13:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 18145 <at> debbugs.gnu.org (full text, mbox):
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
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 30 Aug 2014 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 354 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.