diff --git a/drivers/zero.c b/drivers/zero.c index 9799517..a01bbe1 100644 --- a/drivers/zero.c +++ b/drivers/zero.c @@ -19,6 +19,9 @@ static int zeroClose(struct uAddrVirtualReg *vreg) { struct zeroMappedEntry *ent = (struct zeroMappedEntry *)vreg->res->customData; ent->refCnt--; + if (ent->refCnt == 0) { + free(vreg->res->customData); + } return 0; }