xpath BUGFIX uninitialized variable access
diff --git a/src/xpath.c b/src/xpath.c
index fde0dfc..15404c7 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -5587,6 +5587,9 @@
 
     assert(scnode && (!(scnode->nodetype & (LYS_LIST | LYS_LEAFLIST)) || predicates));
 
+    /* init result set */
+    set_init(&result, set);
+
     if (options & LYXP_SKIP_EXPR) {
         goto cleanup;
     }
@@ -5614,9 +5617,6 @@
         LY_CHECK_GOTO(ret = lyd_create_term2(scnode, &predicates[0].value, &inst), cleanup);
     }
 
-    /* init result set */
-    set_init(&result, set);
-
     for (i = 0; i < set->used; ++i) {
         siblings = NULL;