diff options
author | Denys Vlasenko | 2009-10-08 01:32:44 +0200 |
---|---|---|
committer | Denys Vlasenko | 2009-10-08 01:32:44 +0200 |
commit | d5fddcd57f4e692dd100121bb66adea8129fdbd6 (patch) | |
tree | 48a5885c2bbc2de7c131368f1ddea43b2bdf5717 | |
parent | d427689eee559d5306db3ad379da90e0375d5e5f (diff) | |
download | busybox-d5fddcd57f4e692dd100121bb66adea8129fdbd6.zip busybox-d5fddcd57f4e692dd100121bb66adea8129fdbd6.tar.gz |
cp: revert a recent buggy change, and add a comment why it's wrong
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/cp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 2c0b90b..9f6c123 100644 --- 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() */ |