should free the docs before checking memory leaks