commit disk before free

When auto-freeing a disk, be sure to commit pending changes first.

fixes setActiveBootslot() since the GPT refactor

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
This commit is contained in:
Caleb Connolly
2025-03-24 23:31:41 +01:00
parent e1d7c370bc
commit 39a6e6daaf

View File

@@ -613,6 +613,11 @@ int gpt_disk_get_disk_info(const char *dev, struct gpt_disk *disk)
}
if (disk->is_initialized == GPT_DISK_INIT_MAGIC) {
/* Commit any changes to the disk */
if (gpt_disk_commit(disk)) {
fprintf(stderr, "Failed to commit disk entry");
return -1;
}
// We already have a valid disk handle. Free it.
LOGD("%s: Freeing disk handle for %s... -> %s\n", __func__, disk->devpath, devpath);
gpt_disk_free(disk);