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:
Peter Krempa 2020-10-01 17:28:46 +02:00
parent dad2009de4
commit 704c6c1a39
1 changed files with 2 additions and 3 deletions

View File

@ -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;