ClusterLabs/pacemaker — pull request #23 by anchor (2012-02-13 04:23:10+00:00)
Title: Fix delete_resource in CRM_OP_REPROBE

One of our sysadmins picked this up last week, a case of use-pointer-after-free()

I've been chatting to Florian recently, he suggested this was the best way to get the patch looked at (we didn't even know you guys were using git, we though the hg tree was still current).

----
The GHashTable iterator is invalidated when g_hash_table_remove is called.
Instead, pass down the iterator to delete_rsc_entry so that
g_hash_table_iter_remove can be used directly instead.

Also, use rsc_id_copy, not rsc_id, after the entry rsc_id refers to has been
removed from the resource_history hashtable. rsc_id is aliased with the id
field in the entry itself, and it is freed at this point.