The function dkim_options, when used with DKIM_OPTS_SKIPHDRS or DKIM_OPTS_SIGNHDRS, can produce a memory leak. For example:
dkim_options(dkim_lib, DKIM_OP_SETOPT, DKIM_OPTS_SKIPHDRS, dkim_skip_headers, sizeof(char **));
Later, after calling dkim_close(), memory is not freed. The problem appears to be that dkim_options compiles regex's using regcomp() without later freeing them. If you call the following before dkim_close(), the memory is freed:
dkim_options(dkim_lib, DKIM_OP_SETOPT, DKIM_OPTS_SKIPHDRS, NULL, sizeof(char **));
This is because dkim_options with a NULL ptr value calls regfree(). The attached patch calls regfree() during dkim_close() on any regexes that were compiled for DKIM_OPTS_SKIPHDRS or DKIM_OPTS_SIGNHDRS.
Calls regfree() on regular expressions allocated by dkim_options()
Thanks for the patch!
This had already been discovered during an internal code audit, but the patched code has not yet been released.
I note you've upped the priority from the default. Are you in need of a patched release soon?
Thanks for your prompt response!
No, I don't need an immediate patched release. Thank you for caring, though :) I've patched my own release and can continue quite fine without an official release.
v2.8.3 released, containing this fix.