memory: solve huge memory leak

Link: https://github.com/GeneAssembly/biosal/issues/704
Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>