aboutsummaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2017-02-06 09:42:49 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-02-06 09:42:49 +0100
commit166b9f7709df13b18f7d5942625338da131f390b (patch)
treea1cf7971b1594bc4b114902784421d938d1f6021 /src/buffer.c
parentde369b46b1877d0f5546013518ef2a46932d6757 (diff)
downloadlibssh-166b9f7709df13b18f7d5942625338da131f390b.tar.gz
libssh-166b9f7709df13b18f7d5942625338da131f390b.tar.xz
libssh-166b9f7709df13b18f7d5942625338da131f390b.zip
buffer: Use calloc to allocate a zero'ed buffer
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 9897f391..61b07e9a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -84,12 +84,12 @@ static void buffer_verify(ssh_buffer buf){
* @return A newly initialized SSH buffer, NULL on error.
*/
struct ssh_buffer_struct *ssh_buffer_new(void) {
- struct ssh_buffer_struct *buf = malloc(sizeof(struct ssh_buffer_struct));
-
+ struct ssh_buffer_struct *buf =
+ calloc(1, sizeof(struct ssh_buffer_struct));
if (buf == NULL) {
return NULL;
}
- memset(buf, 0, sizeof(struct ssh_buffer_struct));
+
buffer_verify(buf);
return buf;
}