Fix #49: check allocation status
Release image memory on resize