FIX: memory leak in error condition