if (profile_loaded(secdef->imagelabel) < 0)
return 0;
- if (VIR_ALLOC(ptr) < 0)
- return -1;
+ ptr = g_new0(struct SDPDOP, 1);
ptr->mgr = mgr;
ptr->def = def;
char *tmp = NULL;
virSecurityDACChownItemPtr item = NULL;
- if (VIR_ALLOC(item) < 0)
- return -1;
+ item = g_new0(virSecurityDACChownItem, 1);
tmp = g_strdup(path);
int ret = -1;
if (list->lock) {
- if (VIR_ALLOC_N(paths, list->nItems) < 0)
- return -1;
+ paths = g_new0(const char *, list->nItems);
for (i = 0; i < list->nItems; i++) {
virSecurityDACChownItemPtr item = list->items[i];
return -1;
}
- if (VIR_ALLOC(list) < 0)
- return -1;
+ list = g_new0(virSecurityDACChownList, 1);
list->manager = virObjectRef(mgr);
virCheckFlags(VIR_SECURITY_MANAGER_NEW_MASK, NULL);
- if (VIR_ALLOC_N(privateData, drv->privateDataLen) < 0)
- return NULL;
+ privateData = g_new0(char, drv->privateDataLen);
if (!(mgr = virObjectLockableNew(virSecurityManagerClass)))
goto error;
if (STREQ("stack", mgr->drv->name))
return virSecurityStackGetNested(mgr);
- if (VIR_ALLOC_N(list, 2) < 0)
- return NULL;
+ list = g_new0(virSecurityManagerPtr, 2);
list[0] = mgr;
list[1] = NULL;
const char **locked_paths = NULL;
virSecurityManagerMetadataLockStatePtr ret = NULL;
- if (VIR_ALLOC_N(fds, npaths) < 0 ||
- VIR_ALLOC_N(locked_paths, npaths) < 0)
- return NULL;
+ fds = g_new0(int, npaths);
+ locked_paths = g_new0(const char *, npaths);
/* Sort paths to lock in order to avoid deadlocks with other
* processes. For instance, if one process wants to lock
VIR_APPEND_ELEMENT_COPY_INPLACE(fds, nfds, fd);
}
- if (VIR_ALLOC(ret) < 0)
- goto cleanup;
+ ret = g_new0(virSecurityManagerMetadataLockState, 1);
ret->paths = g_steal_pointer(&locked_paths);
ret->fds = g_steal_pointer(&fds);
int ret = -1;
virSecuritySELinuxContextItemPtr item = NULL;
- if (VIR_ALLOC(item) < 0)
- return -1;
+ item = g_new0(virSecuritySELinuxContextItem, 1);
item->path = g_strdup(path);
item->tcon = g_strdup(tcon);
int ret = -1;
if (list->lock) {
- if (VIR_ALLOC_N(paths, list->nItems) < 0)
- return -1;
+ paths = g_new0(const char *, list->nItems);
for (i = 0; i < list->nItems; i++) {
virSecuritySELinuxContextItemPtr item = list->items[i];
return -1;
}
- if (VIR_ALLOC(list) < 0)
- return -1;
+ list = g_new0(virSecuritySELinuxContextList, 1);
list->manager = virObjectRef(mgr);
while (tmp && tmp->next)
tmp = tmp->next;
- if (VIR_ALLOC(item) < 0)
- return -1;
+ item = g_new0(virSecurityStackItem, 1);
item->securityManager = nested;
item->prev = tmp;
if (tmp)
for (item = priv->itemsHead; item; item = item->next)
len++;
- if (VIR_ALLOC_N(list, len + 1) < 0)
- return NULL;
+ list = g_new0(virSecurityManagerPtr, len + 1);
for (i = 0, item = priv->itemsHead; item; item = item->next, i++)
list[i] = item->securityManager;