*/
void mailbox_free(struct Mailbox **mailbox)
{
- if (mailbox && *mailbox)
- FREE(&(*mailbox)->desc);
+ if (!mailbox || !*mailbox)
+ return;
+
+ FREE(&(*mailbox)->desc);
+ if ((*mailbox)->free_data)
+ (*mailbox)->free_data((*mailbox)->data);
+
FREE(mailbox);
}
struct timespec last_visited; /**< time of last exit from this mailbox */
struct timespec stats_last_checked; /**< mtime of mailbox the last time stats where checked. */
- /* driver hooks */
- void *data; /**< driver specific data */
+ void *data; /**< driver specific data */
+ void (*free_data)(void *); /**< driver-specific data free function */
const struct MxOps *mx_ops;
bool changed : 1; /**< mailbox has been modified */