Skip to content

Commit 06ab611

Browse files
committed
disk.c: check open_part return value in disk_find_partition_by_label
1 parent aa07a03 commit 06ab611

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
@@ -377,6 +377,8 @@ int disk_find_partition_by_label(int drv, const char *label)
377377
}
378378
for (i = 0; i < Drives[drv].n_parts; i++) {
379379
p = open_part(drv, i);
380+
if (p == NULL)
381+
continue;
380382
if (gpt_part_name_eq(p->name, label) == 1)
381383
return i;
382384
}

0 commit comments

Comments
 (0)