[empathy] libempathy: Fix memory leaks and use consistent naming for various arrays.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] libempathy: Fix memory leaks and use consistent naming for various arrays.
- Date: Fri, 24 Dec 2010 14:06:34 +0000 (UTC)
commit f1bc5efbef341a2af2ebf0f9fc3f687503fe7e07
Author: Stef Walter <stefw collabora co uk>
Date: Mon Dec 13 20:25:08 2010 +0000
libempathy: Fix memory leaks and use consistent naming for various arrays.
https://bugzilla.gnome.org/show_bug.cgi?id=636258#c3
libempathy/empathy-tls-verifier.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/libempathy/empathy-tls-verifier.c b/libempathy/empathy-tls-verifier.c
index 23ced4e..183ce66 100644
--- a/libempathy/empathy-tls-verifier.c
+++ b/libempathy/empathy-tls-verifier.c
@@ -466,8 +466,8 @@ empathy_tls_verifier_verify_async (EmpathyTLSVerifier *self,
{
GcrCertificateChain *chain;
GcrCertificate *cert;
- GPtrArray *certs = NULL;
- GArray *cert_data;
+ GPtrArray *cert_data = NULL;
+ GArray *data;
guint idx;
EmpathyTLSVerifierPriv *priv = GET_PRIV (self);
@@ -475,17 +475,17 @@ empathy_tls_verifier_verify_async (EmpathyTLSVerifier *self,
g_return_if_fail (priv->verify_result == NULL);
- g_object_get (priv->certificate, "cert-data", &certs, NULL);
- g_return_if_fail (certs);
+ g_object_get (priv->certificate, "cert-data", &cert_data, NULL);
+ g_return_if_fail (cert_data);
priv->verify_result = g_simple_async_result_new (G_OBJECT (self),
callback, user_data, NULL);
/* Create a certificate chain */
chain = gcr_certificate_chain_new ();
- for (idx = 0; idx < certs->len; ++idx) {
- cert_data = g_ptr_array_index (certs, idx);
- cert = gcr_simple_certificate_new_static (cert_data->data, cert_data->len);
+ for (idx = 0; idx < cert_data->len; ++idx) {
+ data = g_ptr_array_index (cert_data, idx);
+ cert = gcr_simple_certificate_new (data->data, data->len);
gcr_certificate_chain_add (chain, cert);
g_object_unref (cert);
}
@@ -494,7 +494,7 @@ empathy_tls_verifier_verify_async (EmpathyTLSVerifier *self,
NULL, perform_verification_cb, g_object_ref (self));
g_object_unref (chain);
- g_ptr_array_unref (certs);
+ g_boxed_free (TP_ARRAY_TYPE_UCHAR_ARRAY_LIST, cert_data);
}
gboolean
@@ -532,21 +532,22 @@ empathy_tls_verifier_verify_finish (EmpathyTLSVerifier *self,
void
empathy_tls_verifier_store_exception (EmpathyTLSVerifier *self)
{
- GArray *last_cert;
+ GArray *data;
GcrCertificate *cert;
- GPtrArray *certs;
+ GPtrArray *cert_data = NULL;
GError *error = NULL;
EmpathyTLSVerifierPriv *priv = GET_PRIV (self);
- g_object_get (priv->certificate, "cert-data", &certs, NULL);
- last_cert = g_ptr_array_index (certs, certs->len - 1);
- cert = gcr_simple_certificate_new_static ((gpointer)last_cert->data,
- last_cert->len);
+ g_object_get (priv->certificate, "cert-data", &cert_data, NULL);
+ g_return_if_fail (cert_data);
+
+ data = g_ptr_array_index (cert_data, cert_data->len - 1);
+ cert = gcr_simple_certificate_new ((gpointer)data->data, data->len);
if (!gcr_trust_add_pinned_certificate (cert, GCR_PURPOSE_CLIENT_AUTH,
priv->hostname, NULL, &error))
DEBUG ("Can't store the certificate exeption: %s", error->message);
g_object_unref (cert);
- g_ptr_array_unref (certs);
+ g_boxed_free (TP_ARRAY_TYPE_UCHAR_ARRAY_LIST, cert_data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]