Permalink
Browse files

Refactor: Debug use-after-free

  • Loading branch information...
1 parent 44d3e13 commit 9fa2aa46a74175a11531e8e4cae31a7115cea98f @beekhof committed Mar 19, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/cib/cib_native.c
@@ -112,6 +112,7 @@ cib_native_dispatch_internal(const char *buffer, ssize_t length, gpointer userda
}
/* do callbacks */
+ crm_trace("%p: created", msg);
type = crm_element_value(msg, F_TYPE);
crm_trace("Activating %s callbacks...", type);
crm_log_xml_explicit(msg, "cib-reply");
@@ -120,12 +121,18 @@ cib_native_dispatch_internal(const char *buffer, ssize_t length, gpointer userda
cib_native_callback(cib, msg, 0, 0);
} else if (safe_str_eq(type, T_CIB_NOTIFY)) {
- g_list_foreach(cib->notify_list, cib_native_notify, msg);
+ GListPtr iter = cib->notify_list;
+
+ while(iter) {
+ cib_native_notify(iter->data, msg);
+ iter = iter->next;
+ }
} else {
crm_err("Unknown message type: %s", type);
}
+ crm_trace("%p: freeing", msg);
free_xml(msg);
return 0;
}

0 comments on commit 9fa2aa4

Please sign in to comment.