return 0;
}
+_PRIVATE_
+void tevent_common_check_double_free(TALLOC_CTX *ptr, const char *reason)
+{
+ void *parent_ptr = talloc_parent(ptr);
+ size_t parent_blocks = talloc_total_blocks(parent_ptr);
+
+ if (parent_ptr != NULL && parent_blocks == 0) {
+ /*
+ * This is an implicit talloc free,
+ * as we still have a parent but it's
+ * already being destroyed.
+ */
+ return;
+ }
+
+ tevent_abort(NULL, reason);
+}
+
/*
create a event_context structure for a specific implemementation.
This must be the first events call, and all subsequent calls pass
void tevent_abort(struct tevent_context *ev, const char *reason);
+void tevent_common_check_double_free(TALLOC_CTX *ptr, const char *reason);
+
struct tevent_context {
/* the specific events implementation */
const struct tevent_ops *ops;