[fs] bugfix: invalid free on error case