mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nwfilter: Fix double free of pointer
https://bugzilla.redhat.com/show_bug.cgi?id=1071181
Commit 49b59a15
fixed one problem but masks another one related to pointer
freeing.
Avoid putting of the virNWFilterSnoopReq once the thread has been started.
It belongs to the thread and the thread will call virNWFilterSnoopReqPut() on it.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
962abaf538
commit
963dcf905c
@ -1605,6 +1605,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|||||||
int tmp;
|
int tmp;
|
||||||
virThread thread;
|
virThread thread;
|
||||||
virNWFilterVarValuePtr dhcpsrvrs;
|
virNWFilterVarValuePtr dhcpsrvrs;
|
||||||
|
bool threadPuts = false;
|
||||||
|
|
||||||
virNWFilterSnoopIFKeyFMT(ifkey, vmuuid, macaddr);
|
virNWFilterSnoopIFKeyFMT(ifkey, vmuuid, macaddr);
|
||||||
|
|
||||||
@ -1698,6 +1699,8 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|||||||
goto exit_snoopreq_unlock;
|
goto exit_snoopreq_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
threadPuts = true;
|
||||||
|
|
||||||
virAtomicIntInc(&virNWFilterSnoopState.nThreads);
|
virAtomicIntInc(&virNWFilterSnoopState.nThreads);
|
||||||
|
|
||||||
req->threadkey = virNWFilterSnoopActivate(req);
|
req->threadkey = virNWFilterSnoopActivate(req);
|
||||||
@ -1737,7 +1740,8 @@ exit_rem_ifnametokey:
|
|||||||
exit_snoopunlock:
|
exit_snoopunlock:
|
||||||
virNWFilterSnoopUnlock();
|
virNWFilterSnoopUnlock();
|
||||||
exit_snoopreqput:
|
exit_snoopreqput:
|
||||||
virNWFilterSnoopReqPut(req);
|
if (!threadPuts)
|
||||||
|
virNWFilterSnoopReqPut(req);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user