Avoid dangling pointers; tests/stdlib/tmongo.nim now runs successfully.