[Fix] Fix two memory leaks

Right, I was confused for a moment because of the check afterwards...