@@ -462,6 +462,12 @@ lyd_parse_data_(struct ly_ctx *ctx, const char *data, LYD_FORMAT format, int opt
462462 if (options & (LYD_OPT_RPC | LYD_OPT_NOTIF | LYD_OPT_RPCREPLY )) {
463463 data_tree = va_arg (ap , const struct lyd_node * );
464464 if (data_tree ) {
465+ if (options & LYD_OPT_NOEXTDEPS ) {
466+ LOGERR (LY_EINVAL , "%s: invalid parameter (variable arg const struct lyd_node *data_tree and LYD_OPT_NOEXTDEPS set)." ,
467+ __func__ );
468+ return NULL ;
469+ }
470+
465471 LY_TREE_FOR (data_tree , iter ) {
466472 if (iter -> parent ) {
467473 /* a sibling is not top-level */
@@ -478,10 +484,6 @@ lyd_parse_data_(struct ly_ctx *ctx, const char *data, LYD_FORMAT format, int opt
478484 LOGERR (LY_EINVAL , "%s: invalid parameter (variable arg const struct lyd_node *data_tree with LYD_OPT_NOSIBLINGS)." , __func__ );
479485 return NULL ;
480486 }
481- } else if (options & LYD_OPT_NOEXTDEPS ) {
482- LOGERR (LY_EINVAL , "%s: invalid parameter (no variable arg const struct lyd_node *data_tree but LYD_OPT_NOEXTDEPS set)." ,
483- __func__ );
484- return NULL ;
485487 }
486488 }
487489
@@ -4163,6 +4165,12 @@ lyd_validate(struct lyd_node **node, int options, void *var_arg)
41634165 /* get the additional data tree if given */
41644166 data_tree = (struct lyd_node * )var_arg ;
41654167 if (data_tree ) {
4168+ else if (options & LYD_OPT_NOEXTDEPS ) {
4169+ LOGERR (LY_EINVAL , "%s: invalid parameter (variable arg const struct lyd_node *data_tree and LYD_OPT_NOEXTDEPS set)." ,
4170+ __func__ );
4171+ goto cleanup ;
4172+ }
4173+
41664174 LY_TREE_FOR (data_tree , iter ) {
41674175 if (iter -> parent ) {
41684176 /* a sibling is not top-level */
@@ -4173,10 +4181,6 @@ lyd_validate(struct lyd_node **node, int options, void *var_arg)
41734181
41744182 /* move it to the beginning */
41754183 for (; data_tree -> prev -> next ; data_tree = data_tree -> prev );
4176- } else if (options & LYD_OPT_NOEXTDEPS ) {
4177- LOGERR (LY_EINVAL , "%s: invalid parameter (no variable arg const struct lyd_node *data_tree but LYD_OPT_NOEXTDEPS set)." ,
4178- __func__ );
4179- goto cleanup ;
41804184 }
41814185 }
41824186
0 commit comments