path UPDATE context not required for freeing
diff --git a/src/path.c b/src/path.c
index f9b04e9..3876762 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1091,7 +1091,7 @@
     }
     lref = (const struct lysc_type_leafref *)deref_leaf_node->type;
     LY_CHECK_GOTO(ret = ly_path_append(ctx, path2, path), cleanup);
-    ly_path_free(ctx, path2);
+    ly_path_free(path2);
     path2 = NULL;
 
     /* compile dereferenced leafref expression and append it to the path */
@@ -1099,7 +1099,7 @@
             &path2), cleanup);
     node2 = path2[LY_ARRAY_COUNT(path2) - 1].node;
     LY_CHECK_GOTO(ret = ly_path_append(ctx, path2, path), cleanup);
-    ly_path_free(ctx, path2);
+    ly_path_free(path2);
     path2 = NULL;
 
     /* properly parsed path must always continue with ')' and '/' */
@@ -1123,9 +1123,9 @@
     LY_CHECK_GOTO(ret = ly_path_append(ctx, path2, path), cleanup);
 
 cleanup:
-    ly_path_free(ctx, path2);
+    ly_path_free(path2);
     if (ret) {
-        ly_path_free(ctx, *path);
+        ly_path_free(*path);
         *path = NULL;
     }
     return ret;
@@ -1281,7 +1281,7 @@
 
 cleanup:
     if (ret) {
-        ly_path_free(ctx, *path);
+        ly_path_free(*path);
         *path = NULL;
     }
     LOG_LOCBACK(cur_node ? 1 : 0, 0);
@@ -1486,7 +1486,7 @@
 }
 
 void
-ly_path_free(const struct ly_ctx *ctx, struct ly_path *path)
+ly_path_free(struct ly_path *path)
 {
     LY_ARRAY_COUNT_TYPE u;
 
@@ -1495,7 +1495,7 @@
     }
 
     LY_ARRAY_FOR(path, u) {
-        ly_path_predicates_free(ctx, path[u].predicates);
+        ly_path_predicates_free(path[u].node->module->ctx, path[u].predicates);
     }
     LY_ARRAY_FREE(path);
 }