mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
kex: Use calloc() instead of malloc()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user