Fix possible out-of-bounds when trace log level enabled

Also, even when there was no out-of-bounds access, the log statement talked
about an incorrect submission index.
This commit is contained in:
yanchith
2020-05-17 12:17:36 +02:00
parent 000bf85a20
commit 58a60392c2

View File

@@ -27,10 +27,10 @@ impl<B: hal::Backend> CommandPool<B> {
fn maintain(&mut self, lowest_active_index: SubmissionIndex) {
for i in (0..self.pending.len()).rev() {
if self.pending[i].1 < lowest_active_index {
let cmd_buf = self.pending.swap_remove(i).0;
let (cmd_buf, index) = self.pending.swap_remove(i);
log::trace!(
"recycling comb submitted in {} when {} is lowest active",
self.pending[i].1,
index,
lowest_active_index,
);
self.recycle(cmd_buf);