btrfs-progs: subvol_uuid_search: return error on memory allocation failure

This commit fixes coverity defect CID 1328695.

Resolves-coverity-id: 1328695
Signed-off-by: Prasanth K S R <prasanth.ksr@dell.com>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Prasanth K S R 2016-12-10 19:17:42 +05:30 committed by David Sterba
parent c9d43f2f3d
commit adc1e90fb4
1 changed files with 4 additions and 0 deletions

View File

@ -486,6 +486,10 @@ struct subvol_info *subvol_uuid_search(struct subvol_uuid_search *s,
info->path = strdup(path);
} else {
info->path = malloc(PATH_MAX);
if (!info->path) {
ret = -ENOMEM;
goto out;
}
ret = btrfs_subvolid_resolve(s->mnt_fd, info->path,
PATH_MAX, root_id);
}