block: Ensure srcpath backing loop image mount point is not null 08/274408/1 accepted/tizen/unified/20220428.162639 submit/tizen/20220428.054629
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 27 Apr 2022 15:54:45 +0000 (17:54 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 27 Apr 2022 15:54:49 +0000 (17:54 +0200)
This commit addresses SVACE-reported issue.

Change-Id: I03871ae2cda6c5aede9582dc4be62aeb31696b4b

src/block/block.c

index 5e51bab..bdf6e78 100644 (file)
@@ -2574,9 +2574,13 @@ static int get_internal_storage_number(void)
                                fs = mnt_table_find_target(t, p, MNT_ITER_BACKWARD);
                                if (!fs)
                                        continue;
-                               const char *origtemp = temp;
-                               temp = mnt_fs_get_srcpath(fs);
-                               _I("%s is found under mountpoint %s on device %s (internal storage candidate)\n", origtemp, p, temp);
+
+                               const char *loopmnt_srcpath = mnt_fs_get_srcpath(fs);
+                               if (!loopmnt_srcpath)
+                                       continue;
+
+                               _I("%s is found under mountpoint %s on device %s (internal storage candidate)\n", temp, p, loopmnt_srcpath);
+                               temp = loopmnt_srcpath;
                                break;
                        }
                        free(backingfile_path);