diff libpurple/certificate.c @ 19207:8926e15873ca

- Add a helper function to destroy x509_ca_elements, and use it where needed.
author William Ehlhardt <williamehlhardt@gmail.com>
date Mon, 13 Aug 2007 05:52:21 +0000
parents 919395a01483
children 7b81934f4c85
line wrap: on
line diff
--- a/libpurple/certificate.c	Mon Aug 13 05:46:57 2007 +0000
+++ b/libpurple/certificate.c	Mon Aug 13 05:52:21 2007 +0000
@@ -598,6 +598,16 @@
 	PurpleCertificate *crt;
 } x509_ca_element;
 
+static void
+x509_ca_element_free(x509_ca_element *el)
+{
+	if (NULL == el) return;
+
+	g_free(el->dn);
+	purple_certificate_destroy(el->crt);
+	g_free(el);
+}
+
 /** System directory to probe for CA certificates */
 /* TODO: The current path likely won't work on anything but Debian! Fix! */
 static const gchar *x509_ca_syspath = "/etc/ssl/certs/";
@@ -716,11 +726,7 @@
 
 	for (l = x509_ca_certs; l; l = l->next) {
 		x509_ca_element *el = l->data;
-
-		/* TODO: Make this its own function */
-		g_free(el->dn);
-		purple_certificate_destroy(el->crt);
-		g_free(el);
+		x509_ca_element_free(el);
 	}
 	g_list_free(x509_ca_certs);
 	x509_ca_certs = NULL;