Ticket #520: Race condition may cause ioqueue corruption (thanks Philippe Leuba)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1905 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/include/pj/list_i.h b/pjlib/include/pj/list_i.h
index b604d79..5701381 100644
--- a/pjlib/include/pj/list_i.h
+++ b/pjlib/include/pj/list_i.h
@@ -75,6 +75,12 @@
 PJ_IDEF(void) pj_list_erase(pj_list_type *node)
 {
     pj_link_node( ((pj_list*)node)->prev, ((pj_list*)node)->next);
+
+    /* It'll be safer to init the next/prev fields to itself, to
+     * prevent multiple erase() from corrupting the list. See
+     * ticket #520 for one sample bug.
+     */
+    pj_list_init(node);
 }