[btls] Free handle returned by EVP_PKEY_get1_RSA
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 10 Jan 2017 21:14:47 +0000 (22:14 +0100)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 10 Jan 2017 21:20:15 +0000 (22:20 +0100)
From the header docs:

> The |get1| functions return a fresh reference to the underlying
> object or NULL if |pkey| is not of the correct type.

mono/btls/btls-key.c

index 65909a527d9944e0aa27ca42b05505552ca4584d..80ea9ef29cdcd6ae1afb2aef960719996068cbac 100644 (file)
@@ -54,6 +54,8 @@ mono_btls_key_get_bytes (EVP_PKEY *pkey, uint8_t **buffer, int *size, int includ
        else
                ret = RSA_public_key_to_bytes (buffer, &len, rsa);
 
+       RSA_free (rsa);
+
        if (ret != 1)
                return 0;