[ruleview] Part 1: Fixed leaks and test case