Miscellaneous memory leak/uninitialized variable fixes.