Wait, why are you freeing it here?
You didn't duplicate it when you add_assoc_string() it to data, so the zval_ptr_dtor() on data will free it..