From 22f925f593b81f128e0bd36c28448cad40dbdff0 Mon Sep 17 00:00:00 2001 From: Dan Harnett Date: Sat, 10 Feb 2001 15:14:12 +0000 Subject: fix memory leak; ok markus@ --- usr.bin/ssh/scp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.bin/ssh/scp.c') 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) -- cgit v1.2.3