summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/scp.c
diff options
context:
space:
mode:
authorDan Harnett <danh@cvs.openbsd.org>2001-02-10 15:14:12 +0000
committerDan Harnett <danh@cvs.openbsd.org>2001-02-10 15:14:12 +0000
commit22f925f593b81f128e0bd36c28448cad40dbdff0 (patch)
tree8176e81d7da6b465ee4aac884db10fa5f6122936 /usr.bin/ssh/scp.c
parent92fe932b70dba37dd33b290e260649f86433673f (diff)
fix memory leak; ok markus@
Diffstat (limited to 'usr.bin/ssh/scp.c')
-rw-r--r--usr.bin/ssh/scp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index b8d37dc8f11..1974da34324 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -75,7 +75,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.57 2001/02/10 00:12:43 danh Exp $");
+RCSID("$OpenBSD: scp.c,v 1.58 2001/02/10 15:14:11 danh Exp $");
#include "xmalloc.h"
#include "atomicio.h"
@@ -755,6 +755,8 @@ sink(argc, argv)
need = strlen(targ) + strlen(cp) + 250;
if (need > cursize) {
+ if (namebuf)
+ xfree(namebuf);
namebuf = xmalloc(need);
cursize = need;
}
@@ -781,8 +783,10 @@ sink(argc, argv)
if (mkdir(np, mode | S_IRWXU) < 0)
goto bad;
}
- vect[0] = np;
+ vect[0] = xstrdup(np);
sink(1, vect);
+ if (vect[0])
+ xfree(vect[0]);
if (setimes) {
setimes = 0;
if (utimes(np, tv) < 0)