btrfs-progs: handle failed strdup in subvol_uuid_search2

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-12-12 17:53:31 +01:00
parent 98203e8cdb
commit e4fbe791e4
1 changed files with 4 additions and 0 deletions

View File

@ -501,6 +501,10 @@ struct subvol_info *subvol_uuid_search2(struct subvol_uuid_search *s,
info->rtransid = btrfs_root_rtransid(&root_item);
if (type == subvol_search_by_path) {
info->path = strdup(path);
if (!info->path) {
ret = -ENOMEM;
goto out;
}
} else {
info->path = malloc(PATH_MAX);
if (!info->path) {