mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 08:12:20 +00:00
coverity: #1425767
Unchecked return value Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
7eab8fc623
commit
76c00d391a
@ -659,7 +659,7 @@ static void free_btrfs_tree(struct my_btrfs_tree *tree)
|
||||
static bool do_remove_btrfs_children(struct my_btrfs_tree *tree, u64 root_id,
|
||||
const char *path)
|
||||
{
|
||||
int i;
|
||||
int i, ret;
|
||||
char *newpath;
|
||||
size_t len;
|
||||
|
||||
@ -675,7 +675,11 @@ static bool do_remove_btrfs_children(struct my_btrfs_tree *tree, u64 root_id,
|
||||
ERROR("Out of memory");
|
||||
return false;
|
||||
}
|
||||
snprintf(newpath, len, "%s/%s", path, tree->nodes[i].dirname);
|
||||
ret = snprintf(newpath, len, "%s/%s", path, tree->nodes[i].dirname);
|
||||
if (ret < 0 || ret >= len) {
|
||||
free(newpath);
|
||||
return false;
|
||||
}
|
||||
if (!do_remove_btrfs_children(tree, tree->nodes[i].objid, newpath)) {
|
||||
ERROR("Failed to prune %s\n", tree->nodes[i].name);
|
||||
free(newpath);
|
||||
|
Loading…
Reference in New Issue
Block a user