Skip to content

Commit 1d173ff

Browse files
authored
Valgrind fixes 1220 (#521)
* Release iterator upon error * Free up ctx upon exception
1 parent a02f19e commit 1d173ff

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/dag.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ int RedisAI_DagRunSyntaxParser(RedisModuleCtx *ctx, RedisModuleString **argv, in
11761176
if (!mangled_entry) {
11771177
AI_dictRelease(mangled_tensors);
11781178
AI_dictRelease(mangled_persisted);
1179+
AI_dictReleaseIterator(iter);
11791180
return RedisModule_ReplyWithError(ctx, "ERR PERSIST key cannot be found in DAG");
11801181
}
11811182
int *instance = AI_dictGetVal(mangled_entry);

src/libtorch_c/torch_c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ extern "C" void *torchLoadModel(const char *graph, size_t graphlen, DLDeviceType
347347
*error = (char *)alloc(len * sizeof(char));
348348
strcpy(*error, e.what());
349349
(*error)[len - 1] = '\0';
350-
// delete ctx;
350+
delete ctx;
351351
return NULL;
352352
}
353353
return ctx;

0 commit comments

Comments
 (0)