libpurple/protocols/gg/lib/events.c

branch
soc.2012.gg
changeset 33286
98d449073931
parent 33285
32cbdbf016bd
child 35369
7e15c82f7d71
--- a/libpurple/protocols/gg/lib/events.c	Fri May 25 19:05:26 2012 +0000
+++ b/libpurple/protocols/gg/lib/events.c	Fri May 25 20:36:26 2012 +0000
@@ -1,4 +1,4 @@
-/* $Id: events.c 1105 2011-05-25 21:34:50Z wojtekka $ */
+/* $Id: events.c 1144 2011-07-09 15:43:00Z wojtekka $ */
 
 /*
  *  (C) Copyright 2001-2006 Wojtek Kaniewski <wojtekka@irc.pl>
@@ -806,14 +806,14 @@
 				const gnutls_datum_t *peers;
 				gnutls_x509_crt_t cert;
 
-				if (gnutls_x509_crt_init(&cert) >= 0) {
+				if (gnutls_x509_crt_init(&cert) == 0) {
 					peers = gnutls_certificate_get_peers(GG_SESSION_GNUTLS(sess), &peer_count);
 
 					if (peers != NULL) {
 						char buf[256];
 						size_t size;
 
-						if (gnutls_x509_crt_import(cert, &peers[0], GNUTLS_X509_FMT_DER) >= 0) {
+						if (gnutls_x509_crt_import(cert, &peers[0], GNUTLS_X509_FMT_DER) == 0) {
 							size = sizeof(buf);
 							gnutls_x509_crt_get_dn(cert, buf, &size);
 							gg_debug_session(sess, GG_DEBUG_MISC, "//   cert subject: %s\n", buf);
@@ -822,6 +822,8 @@
 							gg_debug_session(sess, GG_DEBUG_MISC, "//   cert issuer: %s\n", buf);
 						}
 					}
+
+					gnutls_x509_crt_deinit(cert);
 				}
 			}
 

mercurial