libyang BUGFIX NULL-pointer dereference

reported by coverity
diff --git a/src/tree_data.c b/src/tree_data.c
index b558038..7fb5d58 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1467,13 +1467,13 @@
     if (parent) {
         /* inner node */
         if (par2 != parent) {
-            LOGERR(parent->module->ctx, LY_EINVAL, "Cannot insert, parent of \"%s\" is not \"%s\".", schema->name, parent->name);
+            LOGERR(schema->module->ctx, LY_EINVAL, "Cannot insert, parent of \"%s\" is not \"%s\".", schema->name, parent->name);
             return LY_EINVAL;
         }
     } else {
         /* top-level node */
         if (par2) {
-            LOGERR(parent->module->ctx, LY_EINVAL, "Cannot insert, node \"%s\" is not top-level.", schema->name);
+            LOGERR(schema->module->ctx, LY_EINVAL, "Cannot insert, node \"%s\" is not top-level.", schema->name);
             return LY_EINVAL;
         }
     }