Skip to content

Commit

Permalink
db: properly handle a reduction in arch filters on transaction commits
Browse files Browse the repository at this point in the history
Fix an off-by-one error that was causing us to leak a db_filter struct
at transaction commit time when we removed an arch/ABI in a transaction.

Reported-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(imported from commit 557a788)
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
  • Loading branch information
pcmoore authored and drakenclimber committed Dec 16, 2024
1 parent 424ee9a commit 2fdc8dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -2570,8 +2570,8 @@ void db_col_transaction_commit(struct db_filter_col *col)
* at the cost of a not reaping all the memory possible */

do {
_db_release(snap->filters[snap->filter_cnt--]);
} while (snap->filter_cnt > col->filter_cnt);
_db_release(snap->filters[--snap->filter_cnt]);
} while (col->filter_cnt < snap->filter_cnt);
}

/* loop through each filter and update the rules on the snapshot */
Expand Down

0 comments on commit 2fdc8dc

Please sign in to comment.