The mutt_free_header() need to care about driver specific data.
BTW, it seems that there is a leak in imap code -- it does not free
HEADER->data->keywords list.
Signed-off-by: Karel Zak <kzak@redhat.com>
#if defined USE_POP || defined USE_IMAP || defined USE_NOTMUCH
void *data; /* driver-specific data */
+ void (*free_cb)(struct header *); /* driver-specific data free function */
#endif
char *maildir_flags; /* unknown maildir flags */
return -1;
}
-static void free_hdrdata(HEADER *h)
+static void free_header_data(HEADER *h)
{
struct nm_hdrdata *data = h->data;
HEADER *h = ctx->hdrs[i];
if (h)
- free_hdrdata(h);
+ free_header_data(h);
}
if (data) {
data->id = safe_strdup(id);
h->data = data;
+ h->free_cb = free_header_data;
+
init_message_tags(data, msg);
return data;
#include "imap.h"
#endif
+#ifdef USE_NOTMUCH
+#include "mutt_notmuch.h"
+#endif
+
#include "mutt_crypt.h"
#include <string.h>
#ifdef MIXMASTER
mutt_free_list (&(*h)->chain);
#endif
-#if defined USE_POP || defined USE_IMAP
+#if defined USE_POP || defined USE_IMAP || defined USE_NOTMUCH
+ if ((*h)->free_cb)
+ (*h)->free_cb(*h);
FREE (&(*h)->data);
#endif
FREE (h); /* __FREE_CHECKED__ */