From c9f3ef39795380e020a2fa129a89357419ab5ac7 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 12 Oct 2009 11:14:18 +0200 Subject: [PATCH] Initialise more variables to NULL --- src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 05d037f..e704da6 100644 --- a/src/main.c +++ b/src/main.c @@ -109,6 +109,7 @@ char *sign_request(char *key, size_t key_len, char *info, char *status, } else { asprintf(&line, "status=%s×tamp=%s", status, timestamp); } + /* XXX Check memory allocation */ gcry_md_open(&hd, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC); gcry_md_setkey(hd, key, key_len); gcry_md_write(hd, line, strlen(line)); @@ -338,13 +339,14 @@ static int handle_request(void * UNUSED(data), void **UNUSED(con_cls)) { const char *id = NULL, *otp = NULL, *h = NULL; - char *uid, *otp_token; + char *uid = NULL, *otp_token = NULL; char *signature = NULL, *status = NULL, *info = NULL, *timestamp = NULL; char *shared_secret; size_t shared_secret_len; yubikey_token_st token; struct ykc_stats stats; memset(&token, '\0', sizeof(token)); + memset(&stats, '\0', sizeof(stats)); timestamp = get_timestamp(); assert(timestamp != NULL); -- 2.39.5