summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sftp-client.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2013-11-08 00:39:16 +0000
committerDamien Miller <djm@cvs.openbsd.org>2013-11-08 00:39:16 +0000
commita0a587ed9761afe84e76d56c1b94d9e03a89a22a (patch)
tree17997fcbcabaf22429a273e688e2e2b5009a34da /usr.bin/ssh/sftp-client.c
parenta43de758d80c580227b07a47b759441c1322b01c (diff)
use calloc for all structure allocations; from markus@
Diffstat (limited to 'usr.bin/ssh/sftp-client.c')
-rw-r--r--usr.bin/ssh/sftp-client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c
index a616aa24f96..aaeee8b0810 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.107 2013/10/17 00:30:13 djm Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.108 2013/11/08 00:39:15 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -470,7 +470,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
if (dir) {
ents = 0;
- *dir = xmalloc(sizeof(**dir));
+ *dir = xcalloc(1, sizeof(**dir));
(*dir)[0] = NULL;
}
@@ -544,7 +544,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
if (dir) {
*dir = xrealloc(*dir, ents + 2, sizeof(**dir));
- (*dir)[ents] = xmalloc(sizeof(***dir));
+ (*dir)[ents] = xcalloc(1, sizeof(***dir));
(*dir)[ents]->filename = xstrdup(filename);
(*dir)[ents]->longname = xstrdup(longname);
memcpy(&(*dir)[ents]->a, a, sizeof(*a));
@@ -563,7 +563,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
/* Don't return partial matches on interrupt */
if (interrupted && dir != NULL && *dir != NULL) {
free_sftp_dirents(*dir);
- *dir = xmalloc(sizeof(**dir));
+ *dir = xcalloc(1, sizeof(**dir));
**dir = NULL;
}
@@ -1136,7 +1136,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
(unsigned long long)offset,
(unsigned long long)offset + buflen - 1,
num_req, max_req);
- req = xmalloc(sizeof(*req));
+ req = xcalloc(1, sizeof(*req));
req->id = conn->msg_id++;
req->len = buflen;
req->offset = offset;
@@ -1500,7 +1500,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
strerror(errno));
if (len != 0) {
- ack = xmalloc(sizeof(*ack));
+ ack = xcalloc(1, sizeof(*ack));
ack->id = ++id;
ack->offset = offset;
ack->len = len;