summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-09-22 21:42:45 +1000
committerDamien Miller <djm@mindrot.org>2011-09-22 21:42:45 +1000
commit57c38ac7d5e81c9fa6643ec8a3ed08c0c96bde64 (patch)
tree27e6690e35fc5c56c9075c46e5677693c2e0e186 /sftp-client.c
parent3decdba42525170d56755bbdab1997b5004d3b9f (diff)
- markus@cvs.openbsd.org 2011/09/12 08:46:15
[sftp-client.c] fix leak in do_lsreaddir(); ok djm
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sftp-client.c b/sftp-client.c
index b6d402143..d7eff70b4 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.95 2011/09/11 16:07:26 markus Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.96 2011/09/12 08:46:15 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -462,12 +462,12 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
462 buffer_put_cstring(&msg, path); 462 buffer_put_cstring(&msg, path);
463 send_msg(conn, &msg); 463 send_msg(conn, &msg);
464 464
465 buffer_clear(&msg);
466
467 handle = get_handle(conn, id, &handle_len, 465 handle = get_handle(conn, id, &handle_len,
468 "remote readdir(\"%s\")", path); 466 "remote readdir(\"%s\")", path);
469 if (handle == NULL) 467 if (handle == NULL) {
468 buffer_free(&msg);
470 return -1; 469 return -1;
470 }
471 471
472 if (dir) { 472 if (dir) {
473 ents = 0; 473 ents = 0;
@@ -510,6 +510,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
510 fx2txt(status)); 510 fx2txt(status));
511 do_close(conn, handle, handle_len); 511 do_close(conn, handle, handle_len);
512 xfree(handle); 512 xfree(handle);
513 buffer_free(&msg);
513 return(status); 514 return(status);
514 } 515 }
515 } else if (type != SSH2_FXP_NAME) 516 } else if (type != SSH2_FXP_NAME)