Fixed leaking resource "var_value"

memory allocated to var_value is not freed at one of return places. It may cause memory leak.