From a3922048431debbd8d5a4fa0a8464b4e7ba47a83 Mon Sep 17 00:00:00 2001 From: Jeffrey Lovitz Date: Mon, 24 Feb 2020 12:28:52 -0500 Subject: [PATCH] Fix leak on projected heap-allocated graph entities --- src/execution_plan/ops/op_project.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/execution_plan/ops/op_project.c b/src/execution_plan/ops/op_project.c index 4b96f73d4b..57970379d9 100644 --- a/src/execution_plan/ops/op_project.c +++ b/src/execution_plan/ops/op_project.c @@ -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);