mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Fix memory leak in zpool_clear_label()
Clang's static analyzer reported a memory leak in zpool_clear_label(). Upon review, it turns out to be right. This should be a very short lived leak because no daemons use this functionality, but that does not preclude the possibility of third party daemons that do use it. Lets fix it to be a good Samaritan. Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Ned Bass <bass6@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #2330
This commit is contained in:
parent
62a05896e8
commit
4def05f8a6
@ -922,8 +922,10 @@ zpool_clear_label(int fd)
|
||||
|
||||
for (l = 0; l < VDEV_LABELS; l++) {
|
||||
if (pwrite64(fd, label, sizeof (vdev_label_t),
|
||||
label_offset(size, l)) != sizeof (vdev_label_t))
|
||||
label_offset(size, l)) != sizeof (vdev_label_t)) {
|
||||
free(label);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
free(label);
|
||||
|
Loading…
Reference in New Issue
Block a user