tap: fix memory errors with create/delete API