diff options
-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 2c0b90bc9..9f6c12367 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -182,10 +182,12 @@ int cp_main(int argc, char **argv) | |||
182 | if (copy_file(*argv, dest, flags) < 0) { | 182 | if (copy_file(*argv, dest, flags) < 0) { |
183 | status = EXIT_FAILURE; | 183 | status = EXIT_FAILURE; |
184 | } | 184 | } |
185 | free((void*)dest); | ||
186 | if (*++argv == last) { | 185 | if (*++argv == last) { |
186 | /* possibly leaking dest... */ | ||
187 | break; | 187 | break; |
188 | } | 188 | } |
189 | /* don't move up: dest may be == last and not malloced! */ | ||
190 | free((void*)dest); | ||
189 | } | 191 | } |
190 | 192 | ||
191 | /* Exit. We are NOEXEC, not NOFORK. We do exit at the end of main() */ | 193 | /* Exit. We are NOEXEC, not NOFORK. We do exit at the end of main() */ |