When using ucl conf file format for ctld, having a duplicate lun or target make ctld segfault with :
(lldb) target create "/usr/sbin/ctld" --core "./ctld.core" Core file '/root/./ctld.core' (x86_64) was loaded. (lldb) bt * thread #1, name = 'ctld', stop reason = signal SIGSEGV * frame #0: ctld`uclparse_conf [inlined] uclparse_target at uclparse.c:637 frame #1: ctld`uclparse_conf at uclparse.c:374 frame #2: ctld`uclparse_conf(newconf=<unavailable>, path=<unavailable>) at uclparse.c:919 frame #3: ctld`conf_new_from_file(path="", oldconf=<unavailable>, ucl=<unavailable>) at ctld.c:2576 frame #4: ctld`main(argc=<unavailable>, argv=<unavailable>) at ctld.c:2693 frame #5: 0x0000000000402f0f ctld`_start + 383
This patch check that target_new() and lun_new() succeed.