schema compile CHANGE pass augment's and uses's when stmt to their children

uses and augment nodes are not present in compiled tree, so their when
statement must be passed to their children to be checked on data.
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index ce0dfb8..63a33ba 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -479,12 +479,16 @@
 }
 
 static void
-lysc_when_free(struct ly_ctx *ctx, struct lysc_when *w)
+lysc_when_free(struct ly_ctx *ctx, struct lysc_when **w)
 {
-    lyxp_expr_free(ctx, w->cond);
-    FREE_STRING(ctx, w->dsc);
-    FREE_STRING(ctx, w->ref);
-    FREE_ARRAY(ctx, w->exts, lysc_ext_instance_free);
+    if (--(*w)->refcount) {
+        return;
+    }
+    lyxp_expr_free(ctx, (*w)->cond);
+    FREE_STRING(ctx, (*w)->dsc);
+    FREE_STRING(ctx, (*w)->ref);
+    FREE_ARRAY(ctx, (*w)->exts, lysc_ext_instance_free);
+    free(*w);
 }
 
 static void
@@ -742,7 +746,7 @@
         LOGINT(ctx);
     }
 
-    FREE_MEMBER(ctx, node->when, lysc_when_free);
+    FREE_ARRAY(ctx, node->when, lysc_when_free);
     FREE_ARRAY(ctx, node->iffeatures, lysc_iffeature_free);
     FREE_ARRAY(ctx, node->exts, lysc_ext_instance_free);
     free(node);