From: Nikos Mavrogiannopoulos Date: Mon, 1 Dec 2003 08:50:32 +0000 (+0000) Subject: eliminated some memory leaks and other fixes. X-Git-Tag: gnutls_1_0_0~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c216faedc2a05a01b995e58f3eb0b3930c883e8a;p=thirdparty%2Fgnutls.git eliminated some memory leaks and other fixes. --- diff --git a/configure.in b/configure.in index f6e6ee8218..42c267683e 100644 --- a/configure.in +++ b/configure.in @@ -17,7 +17,7 @@ GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION", [version of gnutls]) -GNUTLS_GCRYPT_VERSION=1.1.44 +GNUTLS_GCRYPT_VERSION=1.1.90 GNUTLS_LIBTASN1_VERSION=0.2.5 AC_DEFINE_UNQUOTED(GNUTLS_GCRYPT_VERSION, "$GNUTLS_GCRYPT_VERSION", [version of gcrypt]) AC_DEFINE_UNQUOTED(GNUTLS_LIBTASN1_VERSION, "$GNUTLS_LIBTASN1_VERSION", [version of libtasn1]) @@ -262,17 +262,6 @@ AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,, dnl Can't disable - gnutls depends on gcrypt AC_DEFINE(USE_GCRYPT, 1, [use gcrypt]) -# Since libgcrypt 1.1.90 we have a new function to create nonces etc. -# it is useful to use this one instead of the the standard random -# functions. As a temporary solution we check for that function and -# don't require an unrelease libgcrypt. This should be changed after -# libgcrypt 1.2 has been released. -save_LIBS="$LIBS" -LIBS="$LIBS $LIBGCRYPT_LIBS" -AC_CHECK_FUNCS(gcry_create_nonce) -LIBS="$save_LIBS" - - AC_MSG_CHECKING([whether to disable SRP authentication support]) AC_ARG_ENABLE( srp-authentication, [ --disable-srp-authentication Disable the SRP authentication support], ac_enable_srp=no diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c index 1b074e2b6b..1746f963dc 100644 --- a/lib/gnutls_hash_int.c +++ b/lib/gnutls_hash_int.c @@ -31,7 +31,7 @@ GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm algorithm) { GNUTLS_MAC_HANDLE ret = NULL; - gcry_error_t result; + gcry_error_t result = 0; ret = gnutls_malloc(sizeof(GNUTLS_MAC_HANDLE_INT)); if (ret == NULL) { @@ -54,7 +54,7 @@ GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm algorithm) default: gnutls_assert(); gnutls_free( ret); - ret = GNUTLS_HASH_FAILED; break; + ret = GNUTLS_HASH_FAILED; } if (result) { @@ -141,7 +141,7 @@ GNUTLS_MAC_HANDLE _gnutls_hmac_init(gnutls_mac_algorithm algorithm, const void *key, int keylen) { GNUTLS_MAC_HANDLE ret; - gcry_error_t result; + gcry_error_t result = 0; ret = gnutls_malloc(sizeof(GNUTLS_MAC_HANDLE_INT)); if (ret == NULL) diff --git a/lib/gnutls_random.c b/lib/gnutls_random.c index 2937342bb4..849ac3cb91 100644 --- a/lib/gnutls_random.c +++ b/lib/gnutls_random.c @@ -39,12 +39,10 @@ */ int _gnutls_get_random(opaque * res, int bytes, int level) { -#ifdef HAVE_GCRY_CREATE_NONCE if (level == GNUTLS_WEAK_RANDOM) { gcry_create_nonce( res, bytes); return 0; } -#endif gcry_randomize( res, bytes, level); diff --git a/lib/x509/dn.c b/lib/x509/dn.c index 857374a57e..755f72ec55 100644 --- a/lib/x509/dn.c +++ b/lib/x509/dn.c @@ -283,6 +283,7 @@ int _gnutls_x509_parse_dn(ASN1_TYPE asn1_struct, goto cleanup; } STR_APPEND(str_escape(string, escaped, sizeof_escaped)); + gnutls_free(string); string = NULL; } else { char *res; @@ -320,6 +321,7 @@ int _gnutls_x509_parse_dn(ASN1_TYPE asn1_struct, cleanup: gnutls_free( value2); + gnutls_free( string); gnutls_free( escaped); _gnutls_string_clear(&out_str); return result; diff --git a/src/common.c b/src/common.c index c62fd312f9..870ae5aba8 100644 --- a/src/common.c +++ b/src/common.c @@ -323,6 +323,8 @@ void print_openpgp_info(gnutls_session session, const char* hostname) } } + + gnutls_openpgp_key_deinit( crt); } }