| .. | .. |
|---|
| 833 | 833 | INIT_LIST_HEAD(&c->jheads[i].buds_list); |
|---|
| 834 | 834 | err = ubifs_wbuf_init(c, &c->jheads[i].wbuf); |
|---|
| 835 | 835 | if (err) |
|---|
| 836 | | - return err; |
|---|
| 836 | + goto out_wbuf; |
|---|
| 837 | 837 | |
|---|
| 838 | 838 | c->jheads[i].wbuf.sync_callback = &bud_wbuf_callback; |
|---|
| 839 | 839 | c->jheads[i].wbuf.jhead = i; |
|---|
| .. | .. |
|---|
| 841 | 841 | c->jheads[i].log_hash = ubifs_hash_get_desc(c); |
|---|
| 842 | 842 | if (IS_ERR(c->jheads[i].log_hash)) { |
|---|
| 843 | 843 | err = PTR_ERR(c->jheads[i].log_hash); |
|---|
| 844 | | - goto out; |
|---|
| 844 | + goto out_log_hash; |
|---|
| 845 | 845 | } |
|---|
| 846 | 846 | } |
|---|
| 847 | 847 | |
|---|
| .. | .. |
|---|
| 854 | 854 | |
|---|
| 855 | 855 | return 0; |
|---|
| 856 | 856 | |
|---|
| 857 | | -out: |
|---|
| 858 | | - while (i--) |
|---|
| 857 | +out_log_hash: |
|---|
| 858 | + kfree(c->jheads[i].wbuf.buf); |
|---|
| 859 | + kfree(c->jheads[i].wbuf.inodes); |
|---|
| 860 | + |
|---|
| 861 | +out_wbuf: |
|---|
| 862 | + while (i--) { |
|---|
| 863 | + kfree(c->jheads[i].wbuf.buf); |
|---|
| 864 | + kfree(c->jheads[i].wbuf.inodes); |
|---|
| 859 | 865 | kfree(c->jheads[i].log_hash); |
|---|
| 866 | + } |
|---|
| 867 | + kfree(c->jheads); |
|---|
| 868 | + c->jheads = NULL; |
|---|
| 860 | 869 | |
|---|
| 861 | 870 | return err; |
|---|
| 862 | 871 | } |
|---|