From e89a316664cceda7fd3e105f876c159042625ef5 Mon Sep 17 00:00:00 2001 From: Michal Rokos Date: Sat, 8 Jun 2002 11:55:34 +0000 Subject: X509Cert: introduced GetX509CertPtr and DupX509CertPtr X509Ext: fixed memory leaking in ExtFactory after GC --- ossl_x509store.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'ossl_x509store.c') diff --git a/ossl_x509store.c b/ossl_x509store.c index e0714b7..19b9ee2 100644 --- a/ossl_x509store.c +++ b/ossl_x509store.c @@ -200,15 +200,11 @@ ossl_x509store_add_trusted(VALUE self, VALUE cert) GetX509Store(self, storep); - OSSL_Check_Type(cert, cX509Cert); - x509 = ossl_x509_get_X509(cert); + x509 = DupX509CertPtr(cert); /* DUP NEEDED!!! */ if (!X509_STORE_add_cert(storep->store->ctx, x509)) { - X509_free(x509); OSSL_Raise(eX509StoreError, ""); } - X509_free(x509); - return cert; } @@ -318,14 +314,11 @@ static VALUE ossl_x509store_verify(VALUE self, VALUE cert) { ossl_x509store *storep = NULL; - X509 *x509 = NULL; int result = 0; GetX509Store(self, storep); - OSSL_Check_Type(cert, cX509Cert); - x509 = ossl_x509_get_X509(cert); - X509_STORE_CTX_set_cert(storep->store, x509); + X509_STORE_CTX_set_cert(storep->store, GetX509CertPtr(cert)); /* NO DUP NEEDED. */ result = X509_verify_cert(storep->store); /*X509_STORE_CTX_cleanup(storep->store); *clears chain*/ -- cgit v1.2.3