summaryrefslogtreecommitdiffstats
path: root/sftp-client.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-11-08 02:19:55 +0100
committerDamien Miller <djm@mindrot.org>2013-11-08 02:19:55 +0100
commit6c81fee693038de7d4a5559043350391db2a2761 (patch)
treee09e17a18e8556e3b2276b280fa2cd2f2c465f90 /sftp-client.c
parent - dtucker@cvs.openbsd.org 2013/11/07 11:58:27 (diff)
downloadopenssh-6c81fee693038de7d4a5559043350391db2a2761.tar.xz
openssh-6c81fee693038de7d4a5559043350391db2a2761.zip
- djm@cvs.openbsd.org 2013/11/08 00:39:15
[auth-options.c auth2-chall.c authfd.c channels.c cipher-3des1.c] [clientloop.c gss-genr.c monitor_mm.c packet.c schnorr.c umac.c] [sftp-client.c sftp-glob.c] use calloc for all structure allocations; from markus@
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sftp-client.c b/sftp-client.c
index 91955262c..542af8b18 100644
--- a/sftp-client.c
+++ b/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>
*
@@ -477,7 +477,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;
}
@@ -551,7 +551,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));
@@ -570,7 +570,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;
}
@@ -1143,7 +1143,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;
@@ -1512,7 +1512,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;