Skip to content

Commit

Permalink
Fix leak on projected heap-allocated graph entities
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreylovitz committed Feb 27, 2020
1 parent 01e0e26 commit a392204
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/execution_plan/ops/op_project.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ static Record ProjectConsume(OpBase *opBase) {
* TODO This is a rare case; the logic of when to persist can be improved. */
if(!(v.type & SI_GRAPHENTITY)) SIValue_Persist(&v);
Record_Add(op->projection, rec_idx, v);
/* If the value was a graph entity with its own allocation, as with a query like:
* MATCH p = (src) RETURN nodes(p)[0]
* Ensure that the allocation is freed here. */
if((v.type & SI_GRAPHENTITY)) SIValue_Free(v);
}

OpBase_DeleteRecord(op->r);
Expand Down

0 comments on commit a392204

Please sign in to comment.