bitmap_fd_read(): fix memory leak
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
b657208c50
commit
39c74d5e25
3
bitmap.c
3
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",
|
fprintf(stderr, Name ": failed to allocate %zd bytes\n",
|
||||||
sizeof(*info));
|
sizeof(*info));
|
||||||
#endif
|
#endif
|
||||||
|
free(buf);
|
||||||
return NULL;
|
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 "
|
fprintf(stderr, Name ": failed to read superblock of bitmap "
|
||||||
"file: %s\n", strerror(errno));
|
"file: %s\n", strerror(errno));
|
||||||
free(info);
|
free(info);
|
||||||
|
free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy(&info->sb, buf, sizeof(info->sb));
|
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;
|
total_bits = read_bits;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
free(buf);
|
||||||
info->total_bits = total_bits;
|
info->total_bits = total_bits;
|
||||||
info->dirty_bits = dirty_bits;
|
info->dirty_bits = dirty_bits;
|
||||||
return info;
|
return info;
|
||||||
|
|
Loading…
Reference in New Issue