Skip to content

Commit a5a78d5

Browse files
committed
- Cancel the function that frees rinfo copies in case of runQueue creation error (do it inline instead)
1 parent afd31c9 commit a5a78d5

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

src/dag.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,9 @@ static bool DAG_InsertDAGToQueue(RedisAI_RunInfo *rinfo) {
12741274
// A device run queue was not created properly, so we free everything,
12751275
// set an error and finish.
12761276
array_free(devices);
1277-
RAI_DagRunInfoFreeAllCopies(rinfo_copies);
1277+
for (int j = 0; j < ndevices; j++) {
1278+
RAI_DagRunInfoFreeShallowCopy(rinfo_copies[j]);
1279+
}
12781280
array_free(rinfo_copies);
12791281
array_free(run_queues_info);
12801282
RAI_SetError(rinfo->err, RAI_EDAGRUN, "ERR Queue not initialized for device");

src/run_info.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,6 @@ long long RAI_DagRunInfoFreeShallowCopy(RedisAI_RunInfo *rinfo) {
211211
return ref_count;
212212
}
213213

214-
void RAI_DagRunInfoFreeAllCopies(RedisAI_RunInfo **rinfo) {
215-
216-
int ndevices = array_len(rinfo);
217-
for (int i = 0; i < ndevices; i++) {
218-
RAI_DagRunInfoFreeShallowCopy(rinfo[i]);
219-
}
220-
}
221-
222214
void RAI_FreeRunInfo(struct RedisAI_RunInfo *rinfo) {
223215
if (!rinfo) {
224216
return;

src/run_info.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,6 @@ int RAI_ShallowCopyDagRunInfo(RedisAI_RunInfo **result, RedisAI_RunInfo *src);
134134
*/
135135
long long RAI_DagRunInfoFreeShallowCopy(RedisAI_RunInfo *rinfo);
136136

137-
/**
138-
* Free all the shallow copies in the RedisAI_RunInfo array.
139-
* @param rinfo pointers array.
140-
*/
141-
void RAI_DagRunInfoFreeAllCopies(RedisAI_RunInfo **rinfo);
142-
143137
/**
144138
* Frees the memory allocated on RedisAI_RunInfo
145139
* @param ctx Context in which Redis modules operate

0 commit comments

Comments
 (0)