Small scan-build memory fixes
A leak, an unlikely double-free and a dead store.
The last one to initialize a variable wasn't a bug, but setting that unsigned int to zero took a warning off the list so why not. Down to 7 warnings now - would be neat if we could get to zero.