mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
sanlock: avoid leak in acquire()
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
87388d688d
commit
5884adc28a
@ -907,9 +907,6 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (VIR_ALLOC(opt) < 0)
|
||||
return -1;
|
||||
|
||||
/* We only initialize 'sock' if we are in the real
|
||||
* child process and we need it to be inherited
|
||||
*
|
||||
@ -944,6 +941,9 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (VIR_ALLOC(opt) < 0)
|
||||
goto error;
|
||||
|
||||
/* sanlock doesn't use owner_name for anything, so it's safe to take just
|
||||
* the first SANLK_NAME_LEN - 1 characters from vm_name */
|
||||
ignore_value(virStrncpy(opt->owner_name, priv->vm_name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user