summaryrefslogtreecommitdiff
path: root/src/locking
diff options
context:
space:
mode:
authorMartin Kletzander <mkletzan@redhat.com>2014-05-13 13:40:38 +0200
committerMartin Kletzander <mkletzan@redhat.com>2014-05-13 13:50:57 +0200
commit5884adc28a5bc17951c575e7cbf452e63d146927 (patch)
tree26fb8bf735ae6ae9ba9fe2689cf519f3b774099d /src/locking
parent87388d688d2dffd904f653b6860cf3df1633f6b0 (diff)
downloadlibvirt-5884adc28a5bc17951c575e7cbf452e63d146927.tar.gz
sanlock: avoid leak in acquire()
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Diffstat (limited to 'src/locking')
-rw-r--r--src/locking/lock_driver_sanlock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index b3d31bf05b..d0339a6df1 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)
+ 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,