target: fix memory leaks on target_create() fail