From: Pekka Riikonen Date: Fri, 1 Jun 2007 21:56:21 +0000 (+0000) Subject: If key pair loading fails return NULL to return pointer. X-Git-Tag: silc.client.1.1~10 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=aba4dc641eb5fcec41e47f114773060cfcdda2c6 If key pair loading fails return NULL to return pointer. --- diff --git a/lib/silcapputil/silcapputil.c b/lib/silcapputil/silcapputil.c index 67df01eb..6ecdd143 100644 --- a/lib/silcapputil/silcapputil.c +++ b/lib/silcapputil/silcapputil.c @@ -265,6 +265,8 @@ SilcBool silc_load_key_pair(const char *pub_filename, if (!silc_pkcs_load_private_key(prv_filename, (const unsigned char *)pass, strlen(pass), return_private_key)) { + silc_pkcs_public_key_free(*return_public_key); + *return_public_key = NULL; memset(pass, 0, strlen(pass)); silc_free(pass); return FALSE; diff --git a/lib/silccrypt/silcpkcs.c b/lib/silccrypt/silcpkcs.c index 55c4c808..74fd6f03 100644 --- a/lib/silccrypt/silcpkcs.c +++ b/lib/silccrypt/silcpkcs.c @@ -693,6 +693,7 @@ SilcBool silc_pkcs_load_public_key(const char *filename, silc_free(data); silc_free(public_key); + *ret_public_key = NULL; return FALSE; } @@ -778,6 +779,7 @@ SilcBool silc_pkcs_load_private_key(const char *filename, silc_free(data); silc_free(private_key); + *ret_private_key = NULL; return FALSE; }