engine: fix memory leak

Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>