summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sratom.c7
-rw-r--r--tests/sratom_test.c5
2 files changed, 9 insertions, 3 deletions
diff --git a/src/sratom.c b/src/sratom.c
index 4a15911..877f457 100644
--- a/src/sratom.c
+++ b/src/sratom.c
@@ -544,9 +544,8 @@ sratom_read_internal(Sratom* sratom,
SordQuad match;
SordQuad q2 = { node, 0, 0, 0 };
- for (SordIter* i = sord_find(model, q2);
- !sord_iter_end(i);
- sord_iter_next(i)) {
+ SordIter* i = sord_find(model, q2);
+ for (;!sord_iter_end(i); sord_iter_next(i)) {
sord_iter_get(i, match);
const SordNode* p = match[SORD_PREDICATE];
const char* p_uri = (const char*)sord_node_get_string(p);
@@ -558,6 +557,7 @@ sratom_read_internal(Sratom* sratom,
match[SORD_OBJECT], MODE_NORMAL);
}
}
+ sord_iter_free(i);
}
if (frame.ref) {
lv2_atom_forge_pop(forge, &frame);
@@ -638,6 +638,7 @@ sratom_from_turtle(Sratom* sratom,
} else {
fprintf(stderr, "Failed to find node\n");
}
+ sord_iter_free(i);
} else {
fprintf(stderr, "Failed to read Turtle\n");
}
diff --git a/tests/sratom_test.c b/tests/sratom_test.c
index 4ae3f9a..29ead8f 100644
--- a/tests/sratom_test.c
+++ b/tests/sratom_test.c
@@ -226,10 +226,15 @@ main()
}
printf("All tests passed.\n");
+
+ free(parsed);
+ free(instr);
+ free(outstr);
sratom_free(sratom);
for (uint32_t i = 0; i < n_uris; ++i) {
free(uris[i]);
}
free(uris);
+
return 0;
}