comparison libpurple/protocols/msn/soap.c @ 20478:c1c4468207fa

msn_soap_read_buf() shouldn't be used after calling soapconn->read_cb as this callback function can sometimes free soapconn (such as in nexus_login_read_cb after closing nexus connection)
author Carlos Silva <typ0@pidgin.im>
date Tue, 07 Aug 2007 22:07:26 +0000
parents 9a2a4a0c0003
children 6a8463be5b23
comparison
equal deleted inserted replaced
20477:9a2a4a0c0003 20478:c1c4468207fa
472 #endif 472 #endif
473 soapconn->need_to_read = (body_start - soapconn->read_buf + soapconn->body_len) - soapconn->read_len; 473 soapconn->need_to_read = (body_start - soapconn->read_buf + soapconn->body_len) - soapconn->read_len;
474 if ( soapconn->need_to_read > 0 ) { 474 if ( soapconn->need_to_read > 0 ) {
475 return; 475 return;
476 } 476 }
477 //g_free(body_len);
478 477
479 /*remove the read handler*/ 478 /*remove the read handler*/
480 purple_input_remove(soapconn->input_handler); 479 purple_input_remove(soapconn->input_handler);
481 soapconn->input_handler = -1; 480 soapconn->input_handler = -1;
482 /* 481 /*
492 491
493 /*call the read callback*/ 492 /*call the read callback*/
494 if ( soapconn->read_cb != NULL ) { 493 if ( soapconn->read_cb != NULL ) {
495 soapconn->read_cb(soapconn, source, 0); 494 soapconn->read_cb(soapconn, source, 0);
496 } 495 }
497 msn_soap_free_read_buf(soapconn);
498 } 496 }
499 return; 497 return;
500 } 498 }
501 499
502 void 500 void
503 msn_soap_free_read_buf(MsnSoapConn *soapconn) 501 msn_soap_free_read_buf(MsnSoapConn *soapconn)
504 { 502 {
505 if(soapconn->read_buf){ 503 if (soapconn->read_buf) {
506 g_free(soapconn->read_buf); 504 g_free(soapconn->read_buf);
507 } 505 }
508 soapconn->read_buf = NULL; 506 soapconn->read_buf = NULL;
509 soapconn->read_len = 0; 507 soapconn->read_len = 0;
510 soapconn->need_to_read = 0; 508 soapconn->need_to_read = 0;