fix memory leak

the value shouldn't be ref, use z_add_ref is enough