YPERR_ACCESS has mapped to wrong constant

Add more test against it
Fix memory leaks (#59537)