test: add tests for memory leaks

Signed-off-by: Alberto Corona <alberto@0x1a.us>