changeset 13649:b10030f6eab7

[gaim-migrate @ 16050] This should fix Coverity CID 49: buddy was sometimes leaking in _resolve_reply() in src/protocols/bonjour/dns_sd.c committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 17 Apr 2006 23:53:40 +0000
parents 3eba1e7458c7
children 562ad7cc2d29
files src/protocols/bonjour/buddy.c src/protocols/bonjour/buddy.h src/protocols/bonjour/dns_sd.c
diffstat 3 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/bonjour/buddy.c	Mon Apr 17 19:28:15 2006 +0000
+++ b/src/protocols/bonjour/buddy.c	Mon Apr 17 23:53:40 2006 +0000
@@ -27,9 +27,10 @@
  * Creates a new buddy.
  */
 BonjourBuddy *
-bonjour_buddy_new(gchar *name, gchar *first, gint port_p2pj,
-	gchar *phsh, gchar *status, gchar *email, gchar *last, gchar *jid, gchar *AIM,
-	gchar *vc, gchar *ip, gchar *msg)
+bonjour_buddy_new(const gchar *name, const gchar *first, gint port_p2pj,
+	const gchar *phsh, const gchar *status, const gchar *email,
+	const gchar *last, const gchar *jid, const gchar *AIM,
+	const gchar *vc, const gchar *ip, const gchar *msg)
 {
 	BonjourBuddy *buddy = malloc(sizeof(BonjourBuddy));
 
--- a/src/protocols/bonjour/buddy.h	Mon Apr 17 19:28:15 2006 +0000
+++ b/src/protocols/bonjour/buddy.h	Mon Apr 17 23:53:40 2006 +0000
@@ -43,9 +43,10 @@
 /**
  * Creates a new buddy.
  */
-BonjourBuddy *bonjour_buddy_new(gchar *name, gchar *first, gint port_p2pj,
-	gchar *phsh, gchar *status, gchar *email, gchar *last, gchar *jid, gchar *AIM,
-	gchar *vc, gchar *ip, gchar *msg);
+BonjourBuddy *bonjour_buddy_new(const gchar *name, const gchar *first,
+	gint port_p2pj, const gchar *phsh, const gchar *status,
+	const gchar *email, const gchar *last, const gchar *jid,
+	const gchar *AIM, const gchar *vc, const gchar *ip, const gchar *msg);
 
 /**
  * Check if all the compulsory buddy data is present.
--- a/src/protocols/bonjour/dns_sd.c	Mon Apr 17 19:28:15 2006 +0000
+++ b/src/protocols/bonjour/dns_sd.c	Mon Apr 17 23:53:40 2006 +0000
@@ -143,11 +143,12 @@
 
 	/* Put the parameters of the text_record in a buddy and add the buddy to */
 	/* the buddy list */
-	buddy = bonjour_buddy_new((gchar *)name, first, port_p2pj, phsh,
+	buddy = bonjour_buddy_new(name, first, port_p2pj, phsh,
 							  status, email, last, jid, AIM, vc, ip, msg);
 
 	if (bonjour_buddy_check(buddy) == FALSE)
 	{
+		bonjour_buddy_delete(buddy);
 		return SW_DISCOVERY_E_UNKNOWN;
 	}