comparison 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
comparison
equal deleted inserted replaced
19206:919395a01483 19207:8926e15873ca
596 typedef struct { 596 typedef struct {
597 gchar *dn; 597 gchar *dn;
598 PurpleCertificate *crt; 598 PurpleCertificate *crt;
599 } x509_ca_element; 599 } x509_ca_element;
600 600
601 static void
602 x509_ca_element_free(x509_ca_element *el)
603 {
604 if (NULL == el) return;
605
606 g_free(el->dn);
607 purple_certificate_destroy(el->crt);
608 g_free(el);
609 }
610
601 /** System directory to probe for CA certificates */ 611 /** System directory to probe for CA certificates */
602 /* TODO: The current path likely won't work on anything but Debian! Fix! */ 612 /* TODO: The current path likely won't work on anything but Debian! Fix! */
603 static const gchar *x509_ca_syspath = "/etc/ssl/certs/"; 613 static const gchar *x509_ca_syspath = "/etc/ssl/certs/";
604 614
605 /** A list of loaded CAs, populated from the above path whenever the lazy_init 615 /** A list of loaded CAs, populated from the above path whenever the lazy_init
714 { 724 {
715 GList *l; 725 GList *l;
716 726
717 for (l = x509_ca_certs; l; l = l->next) { 727 for (l = x509_ca_certs; l; l = l->next) {
718 x509_ca_element *el = l->data; 728 x509_ca_element *el = l->data;
719 729 x509_ca_element_free(el);
720 /* TODO: Make this its own function */
721 g_free(el->dn);
722 purple_certificate_destroy(el->crt);
723 g_free(el);
724 } 730 }
725 g_list_free(x509_ca_certs); 731 g_list_free(x509_ca_certs);
726 x509_ca_certs = NULL; 732 x509_ca_certs = NULL;
727 x509_ca_initialized = FALSE; 733 x509_ca_initialized = FALSE;
728 } 734 }