* [PATCH] Btrfs-progs: fsck: fix memory leak and unnecessary call to free
@ 2014-03-15 12:22 Rakesh Pandit
0 siblings, 0 replies; only message in thread
From: Rakesh Pandit @ 2014-03-15 12:22 UTC (permalink / raw)
To: linux-btrfs
Free already allocated memory to item1_data if malloc fails for
item2_data in swap_values. Seems to be a typo from commit 70749a77.
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
---
cmds-check.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmds-check.c b/cmds-check.c
index d1cafe1..60708d0 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -2380,7 +2380,7 @@ static int swap_values(struct btrfs_root *root, struct btrfs_path *path,
return -ENOMEM;
item2_data = malloc(item2_size);
if (!item2_data) {
- free(item2_data);
+ free(item1_data);
return -ENOMEM;
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-03-15 12:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-15 12:22 [PATCH] Btrfs-progs: fsck: fix memory leak and unnecessary call to free Rakesh Pandit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox