Commit 3f4ab4c1 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix minor memory leak on invalid bkey

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent ac319b4f
...@@ -852,12 +852,11 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags ...@@ -852,12 +852,11 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags
{ {
struct bch_fs *c = trans->c; struct bch_fs *c = trans->c;
struct btree_insert_entry *i; struct btree_insert_entry *i;
int ret, u64s_delta = 0; int ret = 0, u64s_delta = 0;
#ifdef CONFIG_BCACHEFS_DEBUG #ifdef CONFIG_BCACHEFS_DEBUG
struct printbuf buf = PRINTBUF;
trans_for_each_update(trans, i) { trans_for_each_update(trans, i) {
struct printbuf buf = PRINTBUF;
enum bkey_invalid_flags invalid_flags = 0; enum bkey_invalid_flags invalid_flags = 0;
if (!(flags & BTREE_INSERT_JOURNAL_REPLAY)) if (!(flags & BTREE_INSERT_JOURNAL_REPLAY))
...@@ -865,10 +864,13 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags ...@@ -865,10 +864,13 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags
if (unlikely(bch2_bkey_invalid(c, bkey_i_to_s_c(i->k), if (unlikely(bch2_bkey_invalid(c, bkey_i_to_s_c(i->k),
i->bkey_type, invalid_flags, &buf))) i->bkey_type, invalid_flags, &buf)))
return bch2_trans_commit_bkey_invalid(trans, flags, i, &buf); ret = bch2_trans_commit_bkey_invalid(trans, flags, i, &buf);
btree_insert_entry_checks(trans, i); btree_insert_entry_checks(trans, i);
printbuf_exit(&buf);
if (ret)
return ret;
} }
printbuf_exit(&buf);
#endif #endif
trans_for_each_update(trans, i) { trans_for_each_update(trans, i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment