aboutsummaryrefslogtreecommitdiff
path: root/libssh/wrapper.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-03 12:48:45 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-03 12:48:45 +0000
commit2791ce7e01f9e177d3bd4c49ff2400b04ce9a399 (patch)
treee560e3cc3e836cb056aed0fcacfda77affa60b00 /libssh/wrapper.c
parent8485c87cf207a1935102ed55a68af2bb60134904 (diff)
downloadlibssh-2791ce7e01f9e177d3bd4c49ff2400b04ce9a399.tar.gz
libssh-2791ce7e01f9e177d3bd4c49ff2400b04ce9a399.tar.xz
libssh-2791ce7e01f9e177d3bd4c49ff2400b04ce9a399.zip
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
Diffstat (limited to 'libssh/wrapper.c')
-rw-r--r--libssh/wrapper.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libssh/wrapper.c b/libssh/wrapper.c
index 4e943730..a0c62444 100644
--- a/libssh/wrapper.c
+++ b/libssh/wrapper.c
@@ -466,6 +466,10 @@ static void cipher_free(struct crypto_struct *cipher){
#ifdef HAVE_LIBGCRYPT
unsigned int i;
#endif
+ if (cipher == NULL) {
+ return;
+ }
+
if(cipher->key){
#ifdef HAVE_LIBGCRYPT
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){
+ if (crypto == NULL) {
+ return;
+ }
if(crypto->server_pubkey)
free(crypto->server_pubkey);
if(crypto->in_cipher)