fix mem leak / possible null dereference found by clang

ok oga@