Skip to content

Commit d306f64

Browse files
author
DvirDukhan
committed
fix invalid access after freeing next_item
1 parent 52ce7bd commit d306f64

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/background_workers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ static RedisAI_RunInfo **_BGThread_BatchOperations(RunQueueInfo *run_queue_info,
228228

229229
// If all previous checks pass, then keep track of the item
230230
// in the list of evicted items
231+
queueItem *tmp = queueNext(next_item);
231232
queueItem *evicted = queueEvict(run_queue_info->run_queue, next_item);
232233
RedisModule_Free(evicted);
234+
next_item = tmp;
233235
batch_rinfo = array_append(batch_rinfo, next_rinfo);
234236

235237
// Update the batchsize and go to the next item to see if
@@ -258,7 +260,6 @@ static RedisAI_RunInfo **_BGThread_BatchOperations(RunQueueInfo *run_queue_info,
258260
break;
259261
}
260262
}
261-
next_item = queueNext(next_item);
262263
}
263264
return batch_rinfo;
264265
}

0 commit comments

Comments
 (0)