Made some small modifications (backing extraction)

This commit is contained in:
2024-02-19 20:23:26 +01:00
parent 7513bb37cc
commit a260002a6c
4 changed files with 64 additions and 12 deletions

View File

@@ -396,24 +396,24 @@ result_t get_backing_parent(char** _parent, const char* backing) {
return result;
}
// If the disk is not backed, return success and a null parent
// Free the backing path as it is not needed anymore
free(path);
// Check if the disk is backed
if (info.backing_path == NULL) {
free_disk_info(&info);
free(path);
return success();
}
// Get the backing identifier of the parent
char* parent = strdup(basename(info.backing_path));
if (parent == NULL) {
free_disk_info(&info);
free(path);
return failure("Failed to get the backing identifier of the parent.");
}
// Free the disk info as it is not needed anymore
free_disk_info(&info);
free(path);
if (parent == NULL)
return failure("Failed to get the backing identifier of the parent.");
*_parent = parent;
return result;
return success();
}