Merge "manager.c: Fix potential memory leak and corruption."