return;
FREE(&(*mailbox)->desc);
- if ((*mailbox)->free_data)
- (*mailbox)->free_data((*mailbox)->data);
- (*mailbox)->data = NULL;
-
+ if ((*mailbox)->data && (*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. */
- void *data; /**< driver specific data */
- void (*free_data)(void *); /**< driver-specific data free function */
+ 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 */
* free_mboxdata - Free data attached to the Mailbox
* @param data Private mailbox data
*/
-static void free_mboxdata(void *data)
+static void free_mboxdata(void **data)
{
- if (!data)
+ if (!data || !*data)
return;
- struct MboxData *m = data;
+ struct MboxData *m = *data;
mutt_file_fclose(&m->fp);
}
* the database. This function will close the database, free the resources and
* the struct itself.
*/
-static void free_mboxdata(void *data)
+static void free_mboxdata(void **data)
{
- if (!data)
+ if (!data || !*data)
return;
mutt_debug(1, "nm: freeing context data %p\n", data);
- struct NmMboxData *mdata = data;
+ struct NmMboxData *mdata = *data;
if (mdata->db)
#ifdef NOTMUCH_API_3
url_free(&mdata->db_url);
FREE(&mdata->db_url_holder);
FREE(&mdata->db_query);
- FREE(&mdata);
+ FREE(data);
}
/**
* the database. This function will close the database, free the resources and
* the struct itself.
*/
-static void free_mboxdata(void *data)
+static void free_mboxdata(void **data)
{
- FREE(&data);
+ if (!data || !*data)
+ return;
+
+ FREE(data);
}
/**