[cppcheck] Two memory leaks fixed