usercertinmem: fix memory leaks
This commit is contained in:
parent
c4e6c33b13
commit
18ca0aa984
@ -22,8 +22,9 @@
|
|||||||
/* Example using an in memory PEM user certificate and RSA key to retrieve an
|
/* Example using an in memory PEM user certificate and RSA key to retrieve an
|
||||||
* https page.
|
* https page.
|
||||||
* Written by Ishan SinghLevett, based on Theo Borm's cacertinmem.c.
|
* Written by Ishan SinghLevett, based on Theo Borm's cacertinmem.c.
|
||||||
* Note this example does not use a CA certificate, however one should be used
|
* Note that to maintain simplicity this example does not use a CA certificate
|
||||||
* if you want a properly secure connection
|
* for peer verification. However, some form of peer verification
|
||||||
|
* must be used in real circumstances when a secure connection is required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
@ -152,6 +153,18 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
|||||||
printf("Use Key failed\n");
|
printf("Use Key failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* free resources that have been allocated by openssl functions */
|
||||||
|
if (bio)
|
||||||
|
BIO_free(bio);
|
||||||
|
|
||||||
|
if (kbio)
|
||||||
|
BIO_free(kbio);
|
||||||
|
|
||||||
|
if (rsa)
|
||||||
|
RSA_free(rsa);
|
||||||
|
|
||||||
|
if (cert)
|
||||||
|
X509_free(cert);
|
||||||
|
|
||||||
/* all set to go */
|
/* all set to go */
|
||||||
return CURLE_OK ;
|
return CURLE_OK ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user