@@ -942,7 +942,7 @@ lys_node_addchild(struct lys_node *parent, struct lys_module *module, struct lys
942942 iter -> next = NULL ;
943943 iter -> prev = iter ;
944944 iter -> parent = NULL ;
945- lys_node_free (iter , NULL , 0 );
945+ lys_node_free (ctx , iter , NULL , 0 );
946946 } else {
947947 if (shortcase ) {
948948 /* create the implicit case to allow it to serve as a target of the augments,
@@ -2464,7 +2464,7 @@ lys_augment_free(struct ly_ctx *ctx, struct lys_node_augment *aug,
24642464 /* children from a resolved augment are freed under the target node */
24652465 if (!aug -> target || (aug -> flags & LYS_NOTAPPLIED )) {
24662466 LY_TREE_FOR_SAFE (aug -> child , next , sub ) {
2467- lys_node_free (sub , private_destructor , 0 );
2467+ lys_node_free (ctx , sub , private_destructor , 0 );
24682468 }
24692469 }
24702470
@@ -2722,11 +2722,11 @@ lys_deviation_free(struct lys_module *module, struct lys_deviation *dev,
27222722
27232723 LY_TREE_DFS_END (dev -> orig_node , next , elem );
27242724 }
2725- lys_node_free (dev -> orig_node , NULL , 0 );
2725+ lys_node_free (ctx , dev -> orig_node , NULL , 0 );
27262726 } else {
27272727 /* it's just a shallow copy, freeing one node */
27282728 dev -> orig_node -> module = module ;
2729- lys_node_free (dev -> orig_node , NULL , 1 );
2729+ lys_node_free (ctx , dev -> orig_node , NULL , 1 );
27302730 }
27312731 }
27322732
@@ -2798,20 +2798,15 @@ lys_uses_free(struct ly_ctx *ctx, struct lys_node_uses *uses,
27982798}
27992799
28002800void
2801- lys_node_free (struct lys_node * node , void (* private_destructor )(const struct lys_node * node , void * priv ), int shallow )
2801+ lys_node_free (struct ly_ctx * ctx , struct lys_node * node ,
2802+ void (* private_destructor )(const struct lys_node * node , void * priv ), int shallow )
28022803{
2803- struct ly_ctx * ctx ;
28042804 struct lys_node * sub , * next ;
28052805
28062806 if (!node ) {
28072807 return ;
28082808 }
28092809
2810- assert (node -> module );
2811- assert (node -> module -> ctx );
2812-
2813- ctx = node -> module -> ctx ;
2814-
28152810 /* remove private object */
28162811 if (node -> priv && private_destructor ) {
28172812 private_destructor (node , node -> priv );
@@ -2827,7 +2822,7 @@ lys_node_free(struct lys_node *node, void (*private_destructor)(const struct lys
28272822
28282823 if (!shallow && !(node -> nodetype & (LYS_LEAF | LYS_LEAFLIST ))) {
28292824 LY_TREE_FOR_SAFE (node -> child , next , sub ) {
2830- lys_node_free (sub , private_destructor , 0 );
2825+ lys_node_free (ctx , sub , private_destructor , 0 );
28312826 }
28322827 }
28332828
@@ -2942,7 +2937,7 @@ module_free_common(struct lys_module *module, void (*private_destructor)(const s
29422937 * are placed in the main module altogether */
29432938 if (!module -> type ) {
29442939 LY_TREE_FOR_SAFE (module -> data , next , iter ) {
2945- lys_node_free (iter , private_destructor , 0 );
2940+ lys_node_free (ctx , iter , private_destructor , 0 );
29462941 }
29472942 }
29482943
@@ -3507,7 +3502,7 @@ lys_node_dup_recursion(struct lys_module *module, struct lys_node *parent, const
35073502 return retval ;
35083503
35093504error :
3510- lys_node_free (retval , NULL , 0 );
3505+ lys_node_free (ctx , retval , NULL , 0 );
35113506 return NULL ;
35123507}
35133508
@@ -5149,7 +5144,7 @@ lys_submodule_module_data_free(struct lys_submodule *submodule)
51495144 /* remove parsed data */
51505145 LY_TREE_FOR_SAFE (submodule -> belongsto -> data , next , elem ) {
51515146 if (elem -> module == (struct lys_module * )submodule ) {
5152- lys_node_free (elem , NULL , 0 );
5147+ lys_node_free (submodule -> ctx , elem , NULL , 0 );
51535148 }
51545149 }
51555150}
@@ -5546,7 +5541,7 @@ lys_extension_instances_free(struct ly_ctx *ctx, struct lys_ext_instance **e, un
55465541 case LY_STMT_USES :
55475542 pp = (void * * )& ((struct lys_ext_instance_complex * )e [i ])-> content [substmt [j ].offset ];
55485543 LY_TREE_FOR_SAFE ((struct lys_node * )(* pp ), snext , siter ) {
5549- lys_node_free (siter , NULL , 0 );
5544+ lys_node_free (ctx , siter , NULL , 0 );
55505545 }
55515546 * pp = NULL ;
55525547 break ;
0 commit comments