summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
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 f4f1970b6..2f9793778 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.101 2013/07/25 00:56:51 djm Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.108 2013/11/08 00:39:15 djm 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 *
@@ -471,7 +471,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
471 471
472 if (dir) { 472 if (dir) {
473 ents = 0; 473 ents = 0;
474 *dir = xmalloc(sizeof(**dir)); 474 *dir = xcalloc(1, sizeof(**dir));
475 (*dir)[0] = NULL; 475 (*dir)[0] = NULL;
476 } 476 }
477 477
@@ -545,7 +545,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
545 545
546 if (dir) { 546 if (dir) {
547 *dir = xrealloc(*dir, ents + 2, sizeof(**dir)); 547 *dir = xrealloc(*dir, ents + 2, sizeof(**dir));
548 (*dir)[ents] = xmalloc(sizeof(***dir)); 548 (*dir)[ents] = xcalloc(1, sizeof(***dir));
549 (*dir)[ents]->filename = xstrdup(filename); 549 (*dir)[ents]->filename = xstrdup(filename);
550 (*dir)[ents]->longname = xstrdup(longname); 550 (*dir)[ents]->longname = xstrdup(longname);
551 memcpy(&(*dir)[ents]->a, a, sizeof(*a)); 551 memcpy(&(*dir)[ents]->a, a, sizeof(*a));
@@ -564,7 +564,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
564 /* Don't return partial matches on interrupt */ 564 /* Don't return partial matches on interrupt */
565 if (interrupted && dir != NULL && *dir != NULL) { 565 if (interrupted && dir != NULL && *dir != NULL) {
566 free_sftp_dirents(*dir); 566 free_sftp_dirents(*dir);
567 *dir = xmalloc(sizeof(**dir)); 567 *dir = xcalloc(1, sizeof(**dir));
568 **dir = NULL; 568 **dir = NULL;
569 } 569 }
570 570
@@ -1105,7 +1105,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1105 (unsigned long long)offset, 1105 (unsigned long long)offset,
1106 (unsigned long long)offset + buflen - 1, 1106 (unsigned long long)offset + buflen - 1,
1107 num_req, max_req); 1107 num_req, max_req);
1108 req = xmalloc(sizeof(*req)); 1108 req = xcalloc(1, sizeof(*req));
1109 req->id = conn->msg_id++; 1109 req->id = conn->msg_id++;
1110 req->len = buflen; 1110 req->len = buflen;
1111 req->offset = offset; 1111 req->offset = offset;
@@ -1463,7 +1463,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1463 strerror(errno)); 1463 strerror(errno));
1464 1464
1465 if (len != 0) { 1465 if (len != 0) {
1466 ack = xmalloc(sizeof(*ack)); 1466 ack = xcalloc(1, sizeof(*ack));
1467 ack->id = ++id; 1467 ack->id = ++id;
1468 ack->offset = offset; 1468 ack->offset = offset;
1469 ack->len = len; 1469 ack->len = len;