Fix cppcheck errors

See #286, newest comment. Two memory leaks and a syntax error if ARRAY_LISTS is ever defined.