comparison src/protocols/simple/simple.c @ 14070:72660065eb3e

[gaim-migrate @ 16691] Fix CID 220 and plug some more leaks. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 10 Aug 2006 23:58:24 +0000
parents d594f0466585
children 10e8eb6a4910
comparison
equal deleted inserted replaced
14069:d594f0466585 14070:72660065eb3e
965 965
966 state = xmlnode_get_child(isc, "state"); 966 state = xmlnode_get_child(isc, "state");
967 967
968 if(!state) { 968 if(!state) {
969 gaim_debug_info("simple", "process_incoming_message: no state found\n"); 969 gaim_debug_info("simple", "process_incoming_message: no state found\n");
970 xmlnode_free(isc);
970 return; 971 return;
971 } 972 }
972 973
973 statedata = xmlnode_get_data(state); 974 statedata = xmlnode_get_data(state);
974 if(statedata) { 975 if(statedata) {
1033 static void process_incoming_notify(struct simple_account_data *sip, struct sipmsg *msg) { 1034 static void process_incoming_notify(struct simple_account_data *sip, struct sipmsg *msg) {
1034 gchar *from; 1035 gchar *from;
1035 gchar *fromhdr; 1036 gchar *fromhdr;
1036 gchar *tmp2; 1037 gchar *tmp2;
1037 xmlnode *pidf; 1038 xmlnode *pidf;
1038 xmlnode *basicstatus; 1039 xmlnode *basicstatus = NULL, *tuple, *status;
1039 gboolean isonline = FALSE; 1040 gboolean isonline = FALSE;
1040 1041
1041 fromhdr = sipmsg_find_header(msg, "From"); 1042 fromhdr = sipmsg_find_header(msg, "From");
1042 from = parse_from(fromhdr); 1043 from = parse_from(fromhdr);
1043 if(!from) return; 1044 if(!from) return;
1047 if(!pidf) { 1048 if(!pidf) {
1048 gaim_debug_info("simple", "process_incoming_notify: no parseable pidf\n"); 1049 gaim_debug_info("simple", "process_incoming_notify: no parseable pidf\n");
1049 return; 1050 return;
1050 } 1051 }
1051 1052
1052 basicstatus = xmlnode_get_child(xmlnode_get_child(xmlnode_get_child(pidf, "tuple"), "status"), "basic"); 1053 if ((tuple = xmlnode_get_child(pidf, "tuple")))
1054 if ((status = xmlnode_get_child(tuple, "status")))
1055 basicstatus = xmlnode_get_child(status, "basic");
1053 1056
1054 if(!basicstatus) { 1057 if(!basicstatus) {
1055 gaim_debug_info("simple", "process_incoming_notify: no basic found\n"); 1058 gaim_debug_info("simple", "process_incoming_notify: no basic found\n");
1059 xmlnode_free(pidf);
1056 return; 1060 return;
1057 } 1061 }
1058 1062
1059 tmp2 = xmlnode_get_data(basicstatus); 1063 tmp2 = xmlnode_get_data(basicstatus);
1060 1064
1061 if(!tmp2) { 1065 if(!tmp2) {
1062 gaim_debug_info("simple", "process_incoming_notify: no basic data found\n"); 1066 gaim_debug_info("simple", "process_incoming_notify: no basic data found\n");
1067 xmlnode_free(pidf);
1063 return; 1068 return;
1064 } 1069 }
1065 1070
1066 if(strstr(tmp2, "open")) { 1071 if(strstr(tmp2, "open")) {
1067 isonline = TRUE; 1072 isonline = TRUE;
1209 send_sip_response(sip->gc, msg, 202, "Ok", NULL); 1214 send_sip_response(sip->gc, msg, 202, "Ok", NULL);
1210 goto privend; 1215 goto privend;
1211 } 1216 }
1212 if(acceptheader) { 1217 if(acceptheader) {
1213 gchar *tmp = acceptheader; 1218 gchar *tmp = acceptheader;
1214 int foundpidf = 0; 1219 gboolean foundpidf = FALSE;
1215 int foundxpidf = 0; 1220 gboolean foundxpidf = FALSE;
1216 while(tmp && tmp < acceptheader + strlen(acceptheader)) { 1221 while(tmp && tmp < acceptheader + strlen(acceptheader)) {
1217 gchar *tmp2 = strchr(tmp, ','); 1222 gchar *tmp2 = strchr(tmp, ',');
1218 if(tmp2) *tmp2 = '\0'; 1223 if(tmp2) *tmp2 = '\0';
1219 if(!strcmp("application/pidf+xml", tmp)) 1224 if(!strcmp("application/pidf+xml", tmp))
1220 foundpidf = 1; 1225 foundpidf = TRUE;
1221 if(!strcmp("application/xpidf+xml", tmp)) 1226 if(!strcmp("application/xpidf+xml", tmp))
1222 foundxpidf = 1; 1227 foundxpidf = TRUE;
1223 if(tmp2) { 1228 if(tmp2) {
1224 *tmp2 = ','; 1229 *tmp2 = ',';
1225 tmp = tmp2; 1230 tmp = tmp2;
1226 while(*tmp == ' ') tmp++; 1231 while(*tmp == ' ') tmp++;
1227 } else 1232 } else