File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1486,8 +1486,9 @@ ly_ctx_is_printed(const struct ly_ctx *ctx)
14861486LIBYANG_API_DEF void
14871487ly_ctx_destroy (struct ly_ctx * ctx )
14881488{
1489- uint32_t i ;
14901489 struct lys_module * mod ;
1490+ uint32_t i ;
1491+ LY_ARRAY_COUNT_TYPE u ;
14911492
14921493 if (!ctx ) {
14931494 return ;
@@ -1514,9 +1515,15 @@ ly_ctx_destroy(struct ly_ctx *ctx)
15141515 lysc_module_free (ctx , mod -> compiled );
15151516 mod -> compiled = NULL ;
15161517 }
1518+
1519+ /* even compiled ext definitions can have ext instances, free those, too */
1520+ LY_ARRAY_FOR (mod -> extensions , u ) {
1521+ FREE_ARRAY (ctx , mod -> extensions [u ].exts , lysc_ext_instance_free );
1522+ mod -> extensions [u ].exts = NULL ;
1523+ }
15171524 }
15181525
1519- /* free the modules (with compiled extension definitions) */
1526+ /* free the modules */
15201527 for (i = 0 ; i < ctx -> modules .count ; ++ i ) {
15211528 mod = ctx -> modules .objs [i ];
15221529 lys_module_free (ctx , mod , 0 );
You can’t perform that action at this time.
0 commit comments