schema compile CHANGE leafref validation

- check for circular chain of leafrefs
- store the real type (the first non-leafref) of the leafref's type for easier
  data validation.
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 0934d93..da640f1 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -1078,6 +1078,7 @@
     uint32_t refcount;               /**< reference counter for type sharing */
     const char* path;                /**< target path */
     struct lys_module *path_context; /**< module where the path is defined, so it provides context to resolve prefixes */
+    struct lysc_type *realtype;      /**< pointer to the real (first non-leafref in possible leafrefs chain) type. */
     uint8_t require_instance;        /**< require-instance flag */
 };