Fix use-after-free in free_incl()

Seen after linux update

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `../varnishevent -f varnishevent.conf -r varnish-4.1.0-doc.log -w out -v'.
Program terminated with signal SIGABRT, Aborted.
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
parent a00794a4
......@@ -1562,10 +1562,10 @@ free_format(compiled_fmt_t *fmt)
static void
free_incl(includehead_t inclhead[])
{
inc_t *incl;
inc_t *incl, *tmp;
for (int i = 0; i < MAX_VSL_TAG; i++)
VSTAILQ_FOREACH(incl, &inclhead[i], inclist) {
VSTAILQ_FOREACH_SAFE(incl, &inclhead[i], inclist, tmp) {
if (incl->hdr != NULL)
free(incl->hdr);
free(incl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment