diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index 2054e8171fd4200ffd56aff61929fd57b2f0b9c0..b4280c44949cd8af3ea586b6975da8b4b2f41a38 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c @@ -1740,16 +1740,20 @@ int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr) if (rd) { err = lpt_init_rd(c); if (err) - return err; + goto out_err; } if (wr) { err = lpt_init_wr(c); if (err) - return err; + goto out_err; } return 0; + +out_err: + ubifs_lpt_free(c, 0); + return err; } /**