diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-01-18 18:51:32 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-01-18 18:52:04 +0100 |
commit | 2ea3683347e3694dfaa7f8fb9725bec067e7fac1 (patch) | |
tree | 42afce893a8ef841ffab40947a3ae092e7364cd5 | |
parent | aaeb938ca4c86e87f85346701c0c6972d3a7620f (diff) | |
download | libssh-2ea3683347e3694dfaa7f8fb9725bec067e7fac1.tar.gz libssh-2ea3683347e3694dfaa7f8fb9725bec067e7fac1.tar.xz libssh-2ea3683347e3694dfaa7f8fb9725bec067e7fac1.zip |
kex: Use calloc() instead of malloc()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | src/kex.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -164,7 +164,7 @@ static char **tokenize(const char *chain){ ptr++; } /* now n contains the number of tokens, the first possibly empty if the list was empty too e.g. "" */ - tokens=malloc(sizeof(char *) * (n+1) ); /* +1 for the null */ + tokens = calloc(n + 1, sizeof(char *)); /* +1 for the null */ if (tokens == NULL) { SAFE_FREE(tmp); return NULL; @@ -208,7 +208,7 @@ char **ssh_space_tokenize(const char *chain){ ptr++; } /* now n contains the number of tokens, the first possibly empty if the list was empty too e.g. "" */ - tokens = malloc(sizeof(char *) * (n + 1)); /* +1 for the null */ + tokens = calloc(n + 1, sizeof(char *)); /* +1 for the null */ if (tokens == NULL) { SAFE_FREE(tmp); return NULL; |