From: Nikos Mavrogiannopoulos Date: Wed, 4 Jul 2012 15:49:51 +0000 (+0200) Subject: A deinit function implies GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE. Based on patch by... X-Git-Tag: gnutls_3_1_0pre0~91 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8eb212b1e03671b774ed13071eb72b402e1c0882;p=thirdparty%2Fgnutls.git A deinit function implies GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE. Based on patch by David Woodhouse. --- diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c index e87f1ab69f..de8061f5ab 100644 --- a/lib/gnutls_privkey.c +++ b/lib/gnutls_privkey.c @@ -435,7 +435,8 @@ int ret; * * This function will associate the given callbacks with the * #gnutls_privkey_t structure. At least one of the two callbacks - * must be non-null. + * must be non-null. If a deinitialization function is provided + * then flags is assumed to contain %GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE. * * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a * negative error value. @@ -471,6 +472,10 @@ int ret; pkey->pk_algorithm = pk; pkey->flags = flags; + /* Ensure gnutls_privkey_deinit() calls the deinit_func */ + if (deinit_func) + pkey->flags |= GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE; + return 0; }