fix ktap coredump in testsuite

find the bug by git bisect