Skip to content

Commit 2e8ba43

Browse files
committed
Fix leak in DAG LLAPI
1 parent 8bdbc93 commit 2e8ba43

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/execution/DAG/dag_builder.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ int RAI_DAGAddOpsFromString(RAI_DAGRunCtx *run_info, const char *dag, RAI_Error
171171
res = REDISMODULE_OK;
172172

173173
cleanup:
174+
if (res != REDISMODULE_OK) {
175+
// Release the ops in case of an error (otherwise the ownership is given to run_info)
176+
for (size_t i = 0; i < array_len(new_ops); i++) {
177+
RAI_FreeDagOp(new_ops[i]);
178+
}
179+
}
174180
array_free(new_ops);
175181
for (size_t i = 0; i < argc; i++) {
176182
RedisModule_FreeString(NULL, argv[i]);

0 commit comments

Comments
 (0)