Fix resource leak - mnt_new_table/mnt_free_table 34/257934/1
authorINSUN PYO <insun.pyo@samsung.com>
Fri, 7 May 2021 01:00:09 +0000 (10:00 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Fri, 7 May 2021 01:01:26 +0000 (10:01 +0900)
Change-Id: Ifd1c0466ed9b6003dcc0e168ed2432cf5c3f3fa1

src/block/block.c

index f0e5b0b..667c414 100644 (file)
@@ -2424,13 +2424,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))