mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
Add NULL checks to crypto free functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@380 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -466,6 +466,10 @@ static void cipher_free(struct crypto_struct *cipher){
|
|||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
#endif
|
#endif
|
||||||
|
if (cipher == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(cipher->key){
|
if(cipher->key){
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
for (i=0;i<cipher->keylen/sizeof (gcry_cipher_hd_t);i++)
|
for (i=0;i<cipher->keylen/sizeof (gcry_cipher_hd_t);i++)
|
||||||
@@ -493,6 +497,9 @@ CRYPTO *crypto_new(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void crypto_free(CRYPTO *crypto){
|
void crypto_free(CRYPTO *crypto){
|
||||||
|
if (crypto == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(crypto->server_pubkey)
|
if(crypto->server_pubkey)
|
||||||
free(crypto->server_pubkey);
|
free(crypto->server_pubkey);
|
||||||
if(crypto->in_cipher)
|
if(crypto->in_cipher)
|
||||||
|
|||||||
Reference in New Issue
Block a user