Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/locking/lock_daemon.c | 9 +++------
src/locking/lock_daemon_config.c | 3 +--
src/locking/lock_driver_lockd.c | 7 +++----
src/locking/lock_driver_sanlock.c | 10 ++++------
src/locking/lock_manager.c | 6 ++----
5 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index e1b495e8ba..88fa7b7957 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -120,8 +120,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
virLockDaemonPtr lockd;
virNetServerPtr srv = NULL;
- if (VIR_ALLOC(lockd) < 0)
- return NULL;
+ lockd = g_new0(virLockDaemon, 1);
g_mutex_init(&lockd->lock);
@@ -212,8 +211,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool
privileged)
size_t i;
const char *serverNames[] = { "virtlockd" };
- if (VIR_ALLOC(lockd) < 0)
- return NULL;
+ lockd = g_new0(virLockDaemon, 1);
g_mutex_init(&lockd->lock);
@@ -456,8 +454,7 @@ virLockDaemonClientNew(virNetServerClientPtr client,
unsigned long long timestamp;
bool privileged = opaque != NULL;
- if (VIR_ALLOC(priv) < 0)
- return NULL;
+ priv = g_new0(virLockDaemonClient, 1);
g_mutex_init(&priv->lock);
diff --git a/src/locking/lock_daemon_config.c b/src/locking/lock_daemon_config.c
index c67b0a75e1..6346703715 100644
--- a/src/locking/lock_daemon_config.c
+++ b/src/locking/lock_daemon_config.c
@@ -57,8 +57,7 @@ virLockDaemonConfigNew(bool privileged G_GNUC_UNUSED)
{
virLockDaemonConfigPtr data;
- if (VIR_ALLOC(data) < 0)
- return NULL;
+ data = g_new0(virLockDaemonConfig, 1);
data->max_clients = 1024;
data->admin_max_clients = 5000;
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index bec98dd05f..15d9e5f076 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -316,8 +316,7 @@ static int virLockManagerLockDaemonInit(unsigned int version,
if (driver)
return 0;
- if (VIR_ALLOC(driver) < 0)
- return -1;
+ driver = g_new0(virLockManagerLockDaemonDriver, 1);
driver->requireLeaseForDisks = true;
driver->autoDiskLease = true;
@@ -399,8 +398,8 @@ static int virLockManagerLockDaemonNew(virLockManagerPtr lock,
virCheckFlags(VIR_LOCK_MANAGER_NEW_STARTED, -1);
- if (VIR_ALLOC(priv) < 0)
- return -1;
+ priv = g_new0(virLockManagerLockDaemonPrivate,
+ 1);
switch (type) {
case VIR_LOCK_MANAGER_OBJECT_TYPE_DOMAIN:
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 640033eb97..9c38a1d2f6 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -397,8 +397,7 @@ static int virLockManagerSanlockInit(unsigned int version,
if (sanlockDriver)
return 0;
- if (VIR_ALLOC(sanlockDriver) < 0)
- return -1;
+ sanlockDriver = g_new0(virLockManagerSanlockDriver, 1);
driver = sanlockDriver;
@@ -468,8 +467,8 @@ static int virLockManagerSanlockNew(virLockManagerPtr lock,
return -1;
}
- if (VIR_ALLOC(priv) < 0)
- return -1;
+ priv = g_new0(virLockManagerSanlockPrivate,
+ 1);
priv->flags = flags;
@@ -937,8 +936,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
return 0;
}
- if (VIR_ALLOC(opt) < 0)
- goto error;
+ opt = g_new0(struct sanlk_options, 1);
/* 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 */
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index 07034b1799..d83a192bf6 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -171,8 +171,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
if (driver->drvInit(VIR_LOCK_MANAGER_VERSION, configFile, flags) < 0)
goto cleanup;
- if (VIR_ALLOC(plugin) < 0)
- goto cleanup;
+ plugin = g_new0(virLockManagerPlugin, 1);
plugin->driver = driver;
plugin->handle = handle;
@@ -303,8 +302,7 @@ virLockManagerPtr virLockManagerNew(virLockDriverPtr driver,
CHECK_DRIVER(drvNew, NULL);
- if (VIR_ALLOC(lock) < 0)
- return NULL;
+ lock = g_new0(virLockManager, 1);
lock->driver = driver;
--
2.26.2