libyang REFACTOR applying deviations, augments, and refines (#1217)

They are no longer applied as part of their
definition module compilation but instead their
target module compilation.
diff --git a/src/xpath.c b/src/xpath.c
index be4d59c..a1376b4 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -2956,6 +2956,10 @@
     struct lyxp_expr *dup = NULL;
     uint32_t i, j;
 
+    if (!exp) {
+        goto cleanup;
+    }
+
     dup = calloc(1, sizeof *dup);
     LY_CHECK_ERR_GOTO(!dup, LOGMEM(ctx); ret = LY_EMEM, cleanup);