Fix resource leak - mnt_new_table/mnt_free_table 65/257965/1
authorINSUN PYO <insun.pyo@samsung.com>
Fri, 7 May 2021 01:00:09 +0000 (10:00 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Fri, 7 May 2021 05:50:04 +0000 (05:50 +0000)
Change-Id: Ifd1c0466ed9b6003dcc0e168ed2432cf5c3f3fa1
(cherry picked from commit f2899bfbc2b06d5d20c81e5d948aad94c189ff2a)

src/block/block.c

index 357a64f3ed61de078190cb99093b76e85b5569be..2ac3e686fd187f83e583de284c9c68c962e1ce51 100644 (file)
@@ -2422,13 +2422,18 @@ static int get_internal_storage_number(void)
                return -EPERM;
        }
        temp = mnt_fs_get_srcpath(fs);
-       if (!temp)
+       if (!temp) {
+               mnt_free_table(t);
                return -EPERM;
+       }
 
        name = strrchr(temp, '/');
-       if (!name)
+       if (!name) {
+               mnt_free_table(t);
                return -EPERM;
+       }
        name++;
+
        /* Boot from USB is not handled */
        if (!is_emulator()) {
                if (!fnmatch(MMC_PATH, temp, 0))