Use calloc instead of zeroizing structure after malloc

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-08-01 11:55:50 +02:00
parent 737f9ecc3c
commit d1bf9068a9
5 changed files with 9 additions and 13 deletions

View File

@@ -21,11 +21,10 @@ static int myauthcallback (const char *prompt, char *buf, size_t len,
static int setup(void **state)
{
struct ssh_callbacks_struct *cb;
struct ssh_callbacks_struct *cb = NULL;
cb = malloc(sizeof(struct ssh_callbacks_struct));
cb = calloc(1, sizeof(struct ssh_callbacks_struct));
assert_non_null(cb);
ZERO_STRUCTP(cb);
cb->userdata = (void *) 0x0badc0de;
cb->auth_function = myauthcallback;