Skip to content

Commit 72ac5a5

Browse files
rizlikdanielinux
authored andcommitted
disk.c: check open_part return value in disk_find_partition_by_label
1 parent b0cc295 commit 72ac5a5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/disk.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ int disk_find_partition_by_label(int drv, const char *label)
385385
}
386386
for (i = 0; i < Drives[drv].n_parts; i++) {
387387
p = open_part(drv, i);
388+
if (p == NULL)
389+
continue;
388390
if (gpt_part_name_eq(p->name, label) == 1)
389391
return i;
390392
}

0 commit comments

Comments
 (0)