summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2011-11-01 16:09:33 +0100
committerNeilBrown <neilb@suse.de>2011-11-02 00:48:53 +0100
commit39c74d5e25208e70ac7cc9e63932ff04125e0817 (patch)
tree43800bce79c28d5fb59a7d8c91901652c2c247a9 /bitmap.c
parentMonitor(): free allocated memory on exit (diff)
downloadmdadm-39c74d5e25208e70ac7cc9e63932ff04125e0817.tar.xz
mdadm-39c74d5e25208e70ac7cc9e63932ff04125e0817.zip
bitmap_fd_read(): fix memory leak
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bitmap.c b/bitmap.c
index 2e1ecdac..d02f16e6 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -147,6 +147,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
fprintf(stderr, Name ": failed to allocate %zd bytes\n",
sizeof(*info));
#endif
+ free(buf);
return NULL;
}
@@ -154,6 +155,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
fprintf(stderr, Name ": failed to read superblock of bitmap "
"file: %s\n", strerror(errno));
free(info);
+ free(buf);
return NULL;
}
memcpy(&info->sb, buf, sizeof(info->sb));
@@ -198,6 +200,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
total_bits = read_bits;
}
out:
+ free(buf);
info->total_bits = total_bits;
info->dirty_bits = dirty_bits;
return info;