Skip to content

Commit 3bcde88

Browse files
author
Kent Overstreet
committed
bcachefs: fix tiny leak in bch2_dev_add()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent dbac8fe commit 3bcde88

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

fs/bcachefs/super.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,11 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
18111811
goto err_late;
18121812

18131813
up_write(&c->state_lock);
1814-
return 0;
1814+
out:
1815+
printbuf_exit(&label);
1816+
printbuf_exit(&errbuf);
1817+
bch_err_fn(c, ret);
1818+
return ret;
18151819

18161820
err_unlock:
18171821
mutex_unlock(&c->sb_lock);
@@ -1820,10 +1824,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
18201824
if (ca)
18211825
bch2_dev_free(ca);
18221826
bch2_free_super(&sb);
1823-
printbuf_exit(&label);
1824-
printbuf_exit(&errbuf);
1825-
bch_err_fn(c, ret);
1826-
return ret;
1827+
goto out;
18271828
err_late:
18281829
up_write(&c->state_lock);
18291830
ca = NULL;

0 commit comments

Comments
 (0)