From e37caa01ec08beba768885b445e22e06816bd146 Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Tue, 15 Nov 2011 20:14:14 +0000 Subject: [PATCH] exec_later: use mem_calloc instead of calloc Before this change, exec_later allocates memory for the struct exec_mailcap structure using calloc. However, the memory is freed in exec_mailcap_command using mem_free. Change exec_later to use mem_calloc instead of calloc. Unless CONFIG_FASTMEM is used, mem_free expects to find debugging metadata that only the mem_alloc family of functions store, and thus using mem_free on the memory allocated using calloc causes a crash. --- src/session/download.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/session/download.c b/src/session/download.c index 94b10f429..837f14bbb 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -395,7 +395,7 @@ exec_mailcap_command(void *data) static void exec_later(struct session *ses, unsigned char *handler, unsigned char *file) { - struct exec_mailcap *exec_mailcap = calloc(1, sizeof(*exec_mailcap)); + struct exec_mailcap *exec_mailcap = mem_calloc(1, sizeof(*exec_mailcap)); if (exec_mailcap) { exec_mailcap->ses = ses;