Skip to content
Snippets Groups Projects
Commit a65ca289 authored by Jan Kadlec's avatar Jan Kadlec
Browse files

libknot: rdataset: do not subtract identical memory.

parent d1cb512f
Branches
Tags
No related merge requests found
......@@ -172,8 +172,7 @@ void knot_rdataset_clear(knot_rdataset_t *rrs, mm_ctx_t *mm)
{
if (rrs) {
mm_free(mm, rrs->data);
rrs->data = NULL;
rrs->rr_count = 0;
knot_rdataset_init(rrs);
}
}
......@@ -324,7 +323,7 @@ int knot_rdataset_intersect(const knot_rdataset_t *a, const knot_rdataset_t *b,
int knot_rdataset_subtract(knot_rdataset_t *from, const knot_rdataset_t *what, mm_ctx_t *mm)
{
if (from == NULL || what == NULL) {
if (from == NULL || what == NULL || from->data == what->data) {
return KNOT_EINVAL;
}
......
......@@ -134,7 +134,8 @@ int knot_rdataset_intersect(const knot_rdataset_t *a, const knot_rdataset_t *b,
knot_rdataset_t *out, mm_ctx_t *mm);
/*!
* \brief Does set-like RRS subtraction. \a from RRS is changed.
* \brief Does set-like RRS subtraction. \a from RRS is changed. Both sets must
be unique, i.e. data point to different locations.
* \param from RRS to subtract from.
* \param what RRS to subtract.
* \param mm Memory context use to reallocated \a from data.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment