Fix ctld segfaulting when using ucl conf file format and having duplicated

lun or target

Submitted by:	Nikita Kozlov <nikita.kozlov at blade-group.com>
MFC after:	3 days
Sponsored by:	blade
Differential Revision:	https://reviews.freebsd.org/D12646
This commit is contained in:
Baptiste Daroussin 2017-10-15 08:03:14 +00:00
parent 93ca7f45e7
commit a6aeb2b6e4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324623

View file

@ -619,6 +619,8 @@ uclparse_target(const char *name, const ucl_object_t *top)
const char *key;
target = target_new(conf, name);
if (target == NULL)
return (1);
while ((obj = ucl_iterate_object(top, &it, true))) {
key = ucl_object_key(obj);
@ -807,6 +809,8 @@ uclparse_lun(const char *name, const ucl_object_t *top)
const char *key;
lun = lun_new(conf, name);
if (lun == NULL)
return (1);
while ((obj = ucl_iterate_object(top, &it, true))) {
key = ucl_object_key(obj);