Skip to content

Commit

Permalink
bcachefs: fix tiny leak in bch2_dev_add()
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
  • Loading branch information
Kent Overstreet committed Mar 13, 2025
1 parent dbac8fe commit 3bcde88
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fs/bcachefs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,11 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
goto err_late;

up_write(&c->state_lock);
return 0;
out:
printbuf_exit(&label);
printbuf_exit(&errbuf);
bch_err_fn(c, ret);
return ret;

err_unlock:
mutex_unlock(&c->sb_lock);
Expand All @@ -1820,10 +1824,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
if (ca)
bch2_dev_free(ca);
bch2_free_super(&sb);
printbuf_exit(&label);
printbuf_exit(&errbuf);
bch_err_fn(c, ret);
return ret;
goto out;
err_late:
up_write(&c->state_lock);
ca = NULL;
Expand Down

0 comments on commit 3bcde88

Please sign in to comment.