nwfilter: replace VIR_ALLOC with g_new0
Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a082c3d1a1
commit
6f1af2fe25
@ -562,8 +562,7 @@ virNWFilterSnoopReqNew(const char *ifkey)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(req) < 0)
|
req = g_new0(virNWFilterSnoopReq, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
req->threadStatus = THREAD_STATUS_NONE;
|
req->threadStatus = THREAD_STATUS_NONE;
|
||||||
|
|
||||||
@ -737,8 +736,7 @@ virNWFilterSnoopReqLeaseAdd(virNWFilterSnoopReqPtr req,
|
|||||||
|
|
||||||
virNWFilterSnoopReqUnlock(req);
|
virNWFilterSnoopReqUnlock(req);
|
||||||
|
|
||||||
if (VIR_ALLOC(pl) < 0)
|
pl = g_new0(virNWFilterSnoopIPLease, 1);
|
||||||
return -1;
|
|
||||||
*pl = *plnew;
|
*pl = *plnew;
|
||||||
|
|
||||||
/* protect req->threadkey */
|
/* protect req->threadkey */
|
||||||
@ -1160,8 +1158,7 @@ virNWFilterSnoopDHCPDecodeJobSubmit(virThreadPoolPtr pool,
|
|||||||
if (len <= MIN_VALID_DHCP_PKT_SIZE || len > sizeof(job->packet))
|
if (len <= MIN_VALID_DHCP_PKT_SIZE || len > sizeof(job->packet))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (VIR_ALLOC(job) < 0)
|
job = g_new0(virNWFilterDHCPDecodeJob, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
memcpy(job->packet, pep, len);
|
memcpy(job->packet, pep, len);
|
||||||
job->caplen = len;
|
job->caplen = len;
|
||||||
|
@ -193,8 +193,7 @@ nwfilterStateInitialize(bool privileged,
|
|||||||
!(sysbus = virDBusGetSystemBus()))
|
!(sysbus = virDBusGetSystemBus()))
|
||||||
return VIR_DRV_STATE_INIT_ERROR;
|
return VIR_DRV_STATE_INIT_ERROR;
|
||||||
|
|
||||||
if (VIR_ALLOC(driver) < 0)
|
driver = g_new0(virNWFilterDriverState, 1);
|
||||||
return VIR_DRV_STATE_INIT_ERROR;
|
|
||||||
|
|
||||||
driver->lockFD = -1;
|
driver->lockFD = -1;
|
||||||
if (virMutexInit(&driver->lock) < 0)
|
if (virMutexInit(&driver->lock) < 0)
|
||||||
|
@ -3312,8 +3312,7 @@ ebtablesGetSubChainInsts(virHashTablePtr chains,
|
|||||||
if ((int)idx < 0)
|
if ((int)idx < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (VIR_ALLOC(inst) < 0)
|
inst = g_new0(ebtablesSubChainInst, 1);
|
||||||
goto cleanup;
|
|
||||||
inst->priority = *(const virNWFilterChainPriority *)filter_names[i].value;
|
inst->priority = *(const virNWFilterChainPriority *)filter_names[i].value;
|
||||||
inst->incoming = incoming;
|
inst->incoming = incoming;
|
||||||
inst->protoidx = idx;
|
inst->protoidx = idx;
|
||||||
|
@ -262,8 +262,7 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
|
|||||||
virNWFilterRuleInstPtr ruleinst;
|
virNWFilterRuleInstPtr ruleinst;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (VIR_ALLOC(ruleinst) < 0)
|
ruleinst = g_new0(virNWFilterRuleInst, 1);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
ruleinst->chainSuffix = def->chainsuffix;
|
ruleinst->chainSuffix = def->chainsuffix;
|
||||||
ruleinst->chainPriority = def->chainPriority;
|
ruleinst->chainPriority = def->chainPriority;
|
||||||
|
@ -151,8 +151,7 @@ virNWFilterLockIface(const char *ifname)
|
|||||||
|
|
||||||
ifaceLock = virHashLookup(ifaceLockMap, ifname);
|
ifaceLock = virHashLookup(ifaceLockMap, ifname);
|
||||||
if (!ifaceLock) {
|
if (!ifaceLock) {
|
||||||
if (VIR_ALLOC(ifaceLock) < 0)
|
ifaceLock = g_new0(virNWFilterIfaceLock, 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (virMutexInitRecursive(&ifaceLock->lock) < 0) {
|
if (virMutexInitRecursive(&ifaceLock->lock) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
@ -718,8 +717,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(req) < 0)
|
req = g_new0(virNWFilterIPAddrLearnReq, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!(req->binding = virNWFilterBindingDefCopy(binding)))
|
if (!(req->binding = virNWFilterBindingDefCopy(binding)))
|
||||||
goto err_free_req;
|
goto err_free_req;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user