mirror of https://gitee.com/openkylin/libvirt.git
qemuSlirpNew: Use g_new0 to allocate the slirp object
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
dad2009de4
commit
704c6c1a39
|
@ -81,10 +81,9 @@ qemuSlirpHasFeature(const qemuSlirp *slirp,
|
|||
qemuSlirpPtr
|
||||
qemuSlirpNew(void)
|
||||
{
|
||||
g_autoptr(qemuSlirp) slirp = NULL;
|
||||
g_autoptr(qemuSlirp) slirp = g_new0(qemuSlirp, 1);
|
||||
|
||||
if (VIR_ALLOC(slirp) < 0 ||
|
||||
!(slirp->features = virBitmapNew(QEMU_SLIRP_FEATURE_LAST)))
|
||||
if (!(slirp->features = virBitmapNew(QEMU_SLIRP_FEATURE_LAST)))
|
||||
return NULL;
|
||||
|
||||
slirp->pid = (pid_t)-1;
|
||||
|
|
Loading…
Reference in New Issue