mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
sanlock: fix memory leak
Detected by Coverity. The only way to get to error_unlink is if path was successfully assigned, so the if was useless. Meanwhile, there was a return statement that did not free path. * src/locking/lock_driver_sanlock.c (virLockManagerSanlockSetupLockspace): Fix mem-leak, and drop useless if.
This commit is contained in:
parent
466f902446
commit
a55f18929b
@ -239,7 +239,7 @@ static int virLockManagerSanlockSetupLockspace(void)
|
|||||||
virReportSystemError(-rv,
|
virReportSystemError(-rv,
|
||||||
_("Unable to add lockspace %s"),
|
_("Unable to add lockspace %s"),
|
||||||
path);
|
path);
|
||||||
return -1;
|
goto error_unlink;
|
||||||
} else {
|
} else {
|
||||||
VIR_DEBUG("Lockspace %s is already registered", path);
|
VIR_DEBUG("Lockspace %s is already registered", path);
|
||||||
}
|
}
|
||||||
@ -250,8 +250,7 @@ static int virLockManagerSanlockSetupLockspace(void)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_unlink:
|
error_unlink:
|
||||||
if (path)
|
unlink(path);
|
||||||
unlink(path);
|
|
||||||
error:
|
error:
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user