Fixed leak in verify_cb.
@@ -235,7 +235,7 @@ char* crypto_cert_fingerprint(X509* xcert)
return fp_buffer;
}
-char* crypto_print_name(X509_NAME* name)
+static char* crypto_print_name(X509_NAME* name)
{
char* buffer = NULL;
BIO* outBIO = BIO_new(BIO_s_mem());
@@ -762,9 +762,12 @@ static int verify_cb (int ok, X509_STORE_CTX *csc)
int derr = X509_STORE_CTX_get_error_depth(csc);
X509* where = X509_STORE_CTX_get_current_cert(csc);
const char* what = X509_verify_cert_error_string(err);
+ char* name = crypto_cert_subject(where);
WLog_WARN(TAG, "Certificate verification failure '%s (%d)' at stack position %d", what, err, derr);
- WLog_WARN(TAG, "%s", crypto_cert_subject(where));
+ WLog_WARN(TAG, "%s", name);
+
+ free(name);
}
return ok;
}
