[libvirt] [PATCH] sanlock: avoid leak in acquire()
Martin Kletzander
mkletzan at redhat.com
Tue May 13 11:51:21 UTC 2014
On Tue, May 13, 2014 at 01:47:37PM +0200, Peter Krempa wrote:
>On 05/13/14 13:40, Martin Kletzander wrote:
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>> src/locking/lock_driver_sanlock.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
>> index b3d31bf..e4b4e8e 100644
>> --- a/src/locking/lock_driver_sanlock.c
>> +++ b/src/locking/lock_driver_sanlock.c
>> @@ -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)
>> + return -1;
>
>you need to goto error here. The code you are moving around is opening a
>socket to sanlock which would be left open if this alloc would fail.
>
What a world, rushing gets you nowhere nowadays :-/ I noticed that
immediately after sending.
>> +
>> /* 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,
>>
>
>ACK with that change.
>
>Peter
>
Fixed && pushed && thanks.
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140513/beb0a0cb/attachment-0001.sig>
More information about the libvir-list
mailing list