Mercurial > pidgin
comparison libpurple/upnp.c @ 30131:d60313011111
Fix a read-after-free from valgrind:
Invalid read of size 8
at 0x9BD2816: purple_upnp_cancel_port_mapping (upnp.c:931)
by 0x9BAEF41: purple_network_listen_cancel (network.c:585)
by 0x1A49D7FD: msn_dc_destroy (directconn.c:204)
Address 0x19c3c748 is 8 bytes inside a block of size 16 free'd
at 0x4C239BF: free (vg_replace_malloc.c:325)
by 0xBC1EB97: g_slist_delete_link (gslist.c:446)
by 0x9BD2815: purple_upnp_cancel_port_mapping (upnp.c:928)
by 0x9BAEF41: purple_network_listen_cancel (network.c:585)
by 0x1A49D7FD: msn_dc_destroy (directconn.c:204)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 29 May 2010 22:52:14 +0000 |
parents | 74776878c055 |
children | db7ffb0120d7 |
comparison
equal
deleted
inserted
replaced
30130:74776878c055 | 30131:d60313011111 |
---|---|
919 GSList *l; | 919 GSList *l; |
920 | 920 |
921 /* Remove ar from discovery_callbacks if present; it was inserted after a cb. | 921 /* Remove ar from discovery_callbacks if present; it was inserted after a cb. |
922 * The same cb may be in the list multiple times, so be careful to remove | 922 * The same cb may be in the list multiple times, so be careful to remove |
923 * the one associated with ar. */ | 923 * the one associated with ar. */ |
924 l = discovery_callbacks; | 924 l = discovery_callbacks; |
925 while (l) | 925 while (l) |
926 { | 926 { |
927 if (l->next && (l->next->data == ar)) { | 927 GSList *next = l->next; |
928 discovery_callbacks = g_slist_delete_link(discovery_callbacks, l->next); | 928 |
929 if (next && (next->data == ar)) { | |
930 discovery_callbacks = g_slist_delete_link(discovery_callbacks, next); | |
931 next = l->next; | |
929 discovery_callbacks = g_slist_delete_link(discovery_callbacks, l); | 932 discovery_callbacks = g_slist_delete_link(discovery_callbacks, l); |
930 } | 933 } |
931 | 934 |
932 l = l->next; | 935 l = next; |
933 } | 936 } |
934 | 937 |
935 if (ar->tima > 0) | 938 if (ar->tima > 0) |
936 purple_timeout_remove(ar->tima); | 939 purple_timeout_remove(ar->tima); |
937 | 940 |