virNWFilterDHCPSnoopInit: virHashNew cannot return NULL

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-07-06 10:23:19 +02:00
parent 420f5204cf
commit 00d34a085c

View File

@ -1998,27 +1998,10 @@ virNWFilterDHCPSnoopInit(void)
virNWFilterSnoopState.snoopReqs = virNWFilterSnoopState.snoopReqs =
virHashNew(virNWFilterSnoopReqRelease); virHashNew(virNWFilterSnoopReqRelease);
if (!virNWFilterSnoopState.ifnameToKey ||
!virNWFilterSnoopState.snoopReqs ||
!virNWFilterSnoopState.active)
goto error;
virNWFilterSnoopLeaseFileLoad(); virNWFilterSnoopLeaseFileLoad();
virNWFilterSnoopLeaseFileOpen(); virNWFilterSnoopLeaseFileOpen();
return 0; return 0;
error:
virHashFree(virNWFilterSnoopState.ifnameToKey);
virNWFilterSnoopState.ifnameToKey = NULL;
virHashFree(virNWFilterSnoopState.snoopReqs);
virNWFilterSnoopState.snoopReqs = NULL;
virHashFree(virNWFilterSnoopState.active);
virNWFilterSnoopState.active = NULL;
return -1;
} }
/** /**