projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d427689
)
cp: revert a recent buggy change, and add a comment why it's wrong
author
Denys Vlasenko
<vda.linux@googlemail.com>
Wed, 7 Oct 2009 23:32:44 +0000
(
01:32
+0200)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Wed, 7 Oct 2009 23:32:44 +0000
(
01:32
+0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/cp.c
patch
|
blob
|
history
diff --git
a/coreutils/cp.c
b/coreutils/cp.c
index 2c0b90bc90c06a8276224118c13dd8c0379f9bca..9f6c12367af0ff7d5160ded666af356e56d49ba1 100644
(file)
--- a/
coreutils/cp.c
+++ b/
coreutils/cp.c
@@
-182,10
+182,12
@@
int cp_main(int argc, char **argv)
if (copy_file(*argv, dest, flags) < 0) {
status = EXIT_FAILURE;
}
- free((void*)dest);
if (*++argv == last) {
+ /* possibly leaking dest... */
break;
}
+ /* don't move up: dest may be == last and not malloced! */
+ free((void*)dest);
}
/* Exit. We are NOEXEC, not NOFORK. We do exit at the end of main() */