diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2011-09-12 08:46:16 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2011-09-12 08:46:16 +0000 |
commit | e94afb9054ad78e230617fd139883ef5062d9b7b (patch) | |
tree | d25ff0d20147d31c9e314fee3048f8603eb51925 | |
parent | b84de112d6e4a3b885d1529794456ead657ae2ca (diff) |
fix leak in do_lsreaddir(); ok djm
-rw-r--r-- | usr.bin/ssh/sftp-client.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c index ff9f29c27c5..6f18e009974 100644 --- a/usr.bin/ssh/sftp-client.c +++ b/usr.bin/ssh/sftp-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-client.c,v 1.95 2011/09/11 16:07:26 markus Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.96 2011/09/12 08:46:15 markus Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * @@ -455,12 +455,12 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag, buffer_put_cstring(&msg, path); send_msg(conn, &msg); - buffer_clear(&msg); - handle = get_handle(conn, id, &handle_len, "remote readdir(\"%s\")", path); - if (handle == NULL) + if (handle == NULL) { + buffer_free(&msg); return -1; + } if (dir) { ents = 0; @@ -503,6 +503,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag, fx2txt(status)); do_close(conn, handle, handle_len); xfree(handle); + buffer_free(&msg); return(status); } } else if (type != SSH2_FXP_NAME) |