mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-07 11:10:44 +00:00
scoutfs: free both btree iter keys on error
I noticed while working on other code that we weren't trying to free potentially allocated btree iter keys if one of them saw an allocation failure. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -1371,8 +1371,10 @@ static int btree_iter(struct super_block *sb, struct scoutfs_btree_root *root,
|
||||
|
||||
walk_key = kmalloc(SCOUTFS_BTREE_MAX_KEY_LEN, GFP_NOFS);
|
||||
iter_key = kmalloc(SCOUTFS_BTREE_MAX_KEY_LEN, GFP_NOFS);
|
||||
if (!walk_key || !iter_key)
|
||||
return -ENOMEM;
|
||||
if (!walk_key || !iter_key) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(walk_key, key, key_len);
|
||||
walk_len = key_len;
|
||||
@@ -1414,6 +1416,7 @@ static int btree_iter(struct super_block *sb, struct scoutfs_btree_root *root,
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
kfree(walk_key);
|
||||
kfree(iter_key);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user