service: fix double-free in error path