@@ -589,8 +589,9 @@ LIBYANG_API_DEF LY_ERR
589589lyd_new_list2 (struct lyd_node * parent , const struct lys_module * module , const char * name , const char * keys ,
590590 uint32_t options , struct lyd_node * * node )
591591{
592+ LY_ERR r ;
592593 struct lyd_node * ret = NULL ;
593- const struct lysc_node * schema ;
594+ const struct lysc_node * schema = NULL ;
594595 struct lysc_ext_instance * ext = NULL ;
595596 const struct ly_ctx * ctx = parent ? LYD_CTX (parent ) : (module ? module -> ctx : NULL );
596597 uint32_t getnext_opts = (options & LYD_NEW_VAL_OUTPUT ) ? LYS_GETNEXT_OUTPUT : 0 ;
@@ -606,11 +607,12 @@ lyd_new_list2(struct lyd_node *parent, const struct lys_module *module, const ch
606607 }
607608
608609 /* find schema node */
609- schema = lys_find_child (ctx , parent ? parent -> schema : NULL , module , NULL , 0 , name , 0 , getnext_opts );
610- if (schema && (schema -> nodetype != LYS_LIST )) {
611- schema = NULL ;
610+ r = lys_find_child_node (ctx , parent ? parent -> schema : NULL , module , NULL , 0 , 0 , NULL , name , 0 , getnext_opts ,
611+ & schema , & ext );
612+ if (!r && (schema -> nodetype != LYS_LIST )) {
613+ r = LY_ENOT ;
612614 }
613- LY_CHECK_ERR_RET (! schema , LOGERR (ctx , LY_EINVAL , "List node \"%s\" not found." , name ), LY_ENOTFOUND );
615+ LY_CHECK_ERR_RET (r , LOGERR (ctx , LY_EINVAL , "List node \"%s\" not found." , name ), LY_ENOTFOUND );
614616
615617 if ((schema -> flags & LYS_KEYLESS ) && !keys [0 ]) {
616618 /* key-less list */
0 commit comments