comparison libpurple/protocols/msn/contact.c @ 22808:f62a4a7fe365

Fix a number of leaks. As far as I can tell, MSNP14 now logs in without leaking.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 03 May 2008 23:51:43 +0000
parents 3c98c25b076b
children 5cdd93dac7a2 d756a0477c06
comparison
equal deleted inserted replaced
22807:0b11895cc564 22808:f62a4a7fe365
98 } 98 }
99 99
100 void 100 void
101 msn_callback_state_set_who(MsnCallbackState *state, const gchar *who) 101 msn_callback_state_set_who(MsnCallbackState *state, const gchar *who)
102 { 102 {
103 gchar *nval;
104 g_return_if_fail(state != NULL); 103 g_return_if_fail(state != NULL);
105 104
106 nval = g_strdup(who);
107 g_free(state->who); 105 g_free(state->who);
108 state->who = nval; 106 state->who = g_strdup(who);
109 } 107 }
110 108
111 void 109 void
112 msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid) 110 msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid)
113 { 111 {
114 gchar *nval;
115 g_return_if_fail(state != NULL); 112 g_return_if_fail(state != NULL);
116 113
117 nval = g_strdup(uid);
118 g_free(state->uid); 114 g_free(state->uid);
119 state->uid = nval; 115 state->uid = g_strdup(uid);
120 } 116 }
121 117
122 void 118 void
123 msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name) 119 msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name)
124 { 120 {
125 gchar *nval;
126 g_return_if_fail(state != NULL); 121 g_return_if_fail(state != NULL);
127 122
128 nval = g_strdup(old_group_name);
129 g_free(state->old_group_name); 123 g_free(state->old_group_name);
130 state->old_group_name = nval; 124 state->old_group_name = g_strdup(old_group_name);
131 } 125 }
132 126
133 void 127 void
134 msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name) 128 msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name)
135 { 129 {
136 gchar *nval;
137 g_return_if_fail(state != NULL); 130 g_return_if_fail(state != NULL);
138 131
139 nval = g_strdup(new_group_name);
140 g_free(state->new_group_name); 132 g_free(state->new_group_name);
141 state->new_group_name = nval; 133 state->new_group_name = g_strdup(new_group_name);
142 } 134 }
143 135
144 void 136 void
145 msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid) 137 msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid)
146 { 138 {
147 gchar *nval;
148 g_return_if_fail(state != NULL); 139 g_return_if_fail(state != NULL);
149 140
150 nval = g_strdup(guid);
151 g_free(state->guid); 141 g_free(state->guid);
152 state->guid = nval; 142 state->guid = g_strdup(guid);
153 } 143 }
154 144
155 145
156 void 146 void
157 msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id) 147 msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id)
537 527
538 g_free(passport); 528 g_free(passport);
539 g_free(Name); 529 g_free(Name);
540 g_free(uid); 530 g_free(uid);
541 g_free(type); 531 g_free(type);
532 g_free(mobile_number);
542 passport = Name = uid = type = mobile_number = NULL; 533 passport = Name = uid = type = mobile_number = NULL;
543 mobile = FALSE; 534 mobile = FALSE;
544 535
545 uid = xmlnode_get_data(contactId); 536 uid = xmlnode_get_data(contactId);
546 type = xmlnode_get_data(contactType); 537 type = xmlnode_get_data(contactType);
658 649
659 g_free(passport); 650 g_free(passport);
660 g_free(Name); 651 g_free(Name);
661 g_free(uid); 652 g_free(uid);
662 g_free(type); 653 g_free(type);
654 g_free(mobile_number);
663 } 655 }
664 656
665 static gboolean 657 static gboolean
666 msn_parse_addressbook(MsnContact * contact, xmlnode *node) 658 msn_parse_addressbook(MsnContact * contact, xmlnode *node)
667 { 659 {