File 0001-Plug-Memory-leak-in-find_and_setup_log_root.patch of Package btrfsprogs

From 4145e527ba81c288aa081073e1ce68fa0ceb4107 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dmueller@suse.de>
Date: Fri, 26 Mar 2010 11:25:43 +0100
Subject: [PATCH] Plug Memory leak in find_and_setup_log_root()

The error path forgets to free a previously allocated
memory structure.
---
 disk-io.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/disk-io.c b/disk-io.c
index addebe1..eab3f0b 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -422,12 +422,13 @@ static int find_and_setup_log_root(struct btrfs_root *tree_root,
 			       struct btrfs_super_block *disk_super)
 {
 	u32 blocksize;
+	struct btrfs_root *log_root;
 	u64 blocknr = btrfs_super_log_root(disk_super);
-	struct btrfs_root *log_root = malloc(sizeof(struct btrfs_root));
 
 	if (blocknr == 0)
 		return 0;
 
+	log_root = malloc(sizeof(struct btrfs_root));
 	blocksize = btrfs_level_size(tree_root,
 			     btrfs_super_log_root_level(disk_super));
 
-- 
1.7.0.2

openSUSE Build Service is sponsored by