changeset 13092:edef744647ff

[gaim-migrate @ 15454] a little leak fix committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 02 Feb 2006 04:50:55 +0000
parents 7aea8de78463
children 4f615c9fb63a
files src/protocols/simple/simple.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/simple/simple.c	Thu Feb 02 00:33:30 2006 +0000
+++ b/src/protocols/simple/simple.c	Thu Feb 02 04:50:55 2006 +0000
@@ -153,7 +153,7 @@
 }
 
 static struct simple_watcher *watcher_create(struct simple_account_data *sip, gchar *name, gchar *callid, gchar *ourtag, gchar *theirtag) {
-	struct simple_watcher *watcher = g_new0(struct simple_watcher,1);
+	struct simple_watcher *watcher = g_new0(struct simple_watcher, 1);
 	watcher->name = g_strdup(name);
 	watcher->dialog.callid = g_strdup(callid);
 	watcher->dialog.ourtag = g_strdup(ourtag);
@@ -489,7 +489,7 @@
 	gchar *name;
 	gchar *value;
 	GString *outstr = g_string_new("");
-	
+
 	/* When sending the acknowlegements and errors, the content length from the original
 	   message is still here, but there is no body; we need to make sure we're sending the
 	   correct content length */
@@ -547,18 +547,21 @@
 
 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) {
 	struct simple_account_data *sip = gc->proto_data;
-	char *callid= dialog ? g_strdup(dialog->callid) : gencallid();
-	char *auth="";
-	char *addh="";
+	char *callid = dialog ? g_strdup(dialog->callid) : gencallid();
+	char *auth = "";
+	char *addh = "";
 	gchar *branch = genbranch();
 	char *buf;
 
 	if(!strcmp(method,"REGISTER")) {
-		if(sip->regcallid) callid = g_strdup(sip->regcallid);
+		if(sip->regcallid) {
+			g_free(callid);
+			callid = g_strdup(sip->regcallid);
+		}
 		else sip->regcallid = g_strdup(callid);
 	}
 
-	if(addheaders) addh=addheaders;
+	if(addheaders) addh = addheaders;
 	if(sip->registrar.type && !strcmp(method,"REGISTER")) {
 		buf = auth_header(sip, &sip->registrar, method, url);
 		auth = g_strdup_printf("Authorization: %s", buf);
@@ -1212,7 +1215,7 @@
 	sip->fd = source;
 
 	conn = connection_create(sip, source);
-	
+
 	sip->registertimeout = gaim_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip);
 
 	do_register(sip);