Fixed a bug and added resetting

This commit is contained in:
2024-02-18 14:43:38 +01:00
parent 4d859efdac
commit cf6e692289
3 changed files with 101 additions and 8 deletions

View File

@@ -431,8 +431,16 @@ Status ResetEntryDisk(const char* entry_identifier, const char* backing_identifi
}
// If no backing disk is specified, use the current backing disk
if (backing_disk_path == NULL)
backing_disk_path = disk_info.backing_file;
if (backing_disk_path == NULL) {
backing_disk_path = strdup(disk_info.backing_file);
if (backing_disk_path == NULL) {
Log(LOG_LEVEL_ERROR, "Failed to allocate memory for the backing disk path (%s).", strerror(errno));
FreeDiskInfo(&disk_info);
free(entry_disk_path);
return FAILURE;
}
}
// Reset the disk
if (backing_disk_path != NULL)
@@ -481,4 +489,3 @@ Status TrimEntryDisk(const char* entry_identifier) {
return status;
}