fix: two potential memleaks

Found by houz' clang analysis: http://houz.org/clang/