Fixed memleak in detection handlers.