Mercurial > pidgin
changeset 28346:33856dfb5cbf
Donot use a servconn if it's freed. Mark a leak.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 08 Oct 2009 18:14:41 +0000 |
parents | 372f6b7b7f04 |
children | c5e0b85c3145 |
files | libpurple/protocols/msn/notification.c libpurple/protocols/msn/servconn.c libpurple/protocols/msn/servconn.h |
diffstat | 3 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c Thu Oct 08 18:12:06 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Thu Oct 08 18:14:41 2009 +0000 @@ -582,7 +582,7 @@ trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len); msn_transaction_set_payload(trans, payload, payload_len); - msn_transaction_set_data(trans, data); + msn_transaction_set_data(trans, data); /* XXX: 'data' leaks */ msn_cmdproc_send_trans(cmdproc, trans); }
--- a/libpurple/protocols/msn/servconn.c Thu Oct 08 18:12:06 2009 +0000 +++ b/libpurple/protocols/msn/servconn.c Thu Oct 08 18:14:41 2009 +0000 @@ -440,11 +440,12 @@ memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1); servconn->rx_len += len; - msn_servconn_process_data(servconn); - servconn_timeout_renew(servconn); + servconn = msn_servconn_process_data(servconn); + if (servconn) + servconn_timeout_renew(servconn); } -void msn_servconn_process_data(MsnServConn *servconn) +MsnServConn *msn_servconn_process_data(MsnServConn *servconn) { char *cur, *end, *old_rx_buf; int cur_len; @@ -503,10 +504,13 @@ servconn->processing = FALSE; - if (servconn->wasted) + if (servconn->wasted) { msn_servconn_destroy(servconn); + servconn = NULL; + } g_free(old_rx_buf); + return servconn; } #if 0
--- a/libpurple/protocols/msn/servconn.h Thu Oct 08 18:12:06 2009 +0000 +++ b/libpurple/protocols/msn/servconn.h Thu Oct 08 18:14:41 2009 +0000 @@ -178,8 +178,10 @@ * data from the socket. * * @param servconn The servconn. + * + * @return @c NULL if servconn was destroyed, 'servconn' otherwise. */ -void msn_servconn_process_data(MsnServConn *servconn); +MsnServConn *msn_servconn_process_data(MsnServConn *servconn); /** * Set a idle timeout fot this servconn