]> git.0d.be Git - empathy.git/commitdiff
libempathy: Fix reference counting of certs in verifier.
authorStef Walter <stefw@collabora.co.uk>
Thu, 9 Dec 2010 22:14:19 +0000 (22:14 +0000)
committerStef Walter <stefw@collabora.co.uk>
Fri, 24 Dec 2010 13:40:02 +0000 (07:40 -0600)
libempathy/empathy-tls-verifier.c

index a0feb77e8e838defc4855a4660d60292599d3d0f..386e3ce7a61242a87f420cf002348a3ca83cbf13 100644 (file)
@@ -138,7 +138,6 @@ check_is_certificate_anchor (EmpathyTLSVerifier *self, GcrCertificate *cert)
 
   ret = gcr_trust_is_certificate_anchor (cert, GCR_PURPOSE_CLIENT_AUTH,
           NULL, &error);
-  g_object_unref (cert);
 
   if (!ret && error) {
       DEBUG ("Can't lookup certificate anchor: %s", error->message);
@@ -327,7 +326,10 @@ perform_verification (EmpathyTLSVerifier *self)
    */
   cert_data = g_ptr_array_index (certs, 0);
   cert = gcr_simple_certificate_new_static (cert_data->data, cert_data->len);
-  if (check_is_certificate_exception (self, cert)) {
+  ret = check_is_certificate_exception (self, cert);
+  g_object_unref (cert);
+
+  if (ret) {
       DEBUG ("Found certificate exception for %s", priv->hostname);
       complete_verification (self);
       goto out;