Fix memory leak found by clang's static analyzer