memory_cache: don't allocate the pointer twice (bug fix)

Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>
tests: add more tests for memory_cache structure

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