Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
vircgroupv2devices: free BPF map when replacing with new one
Browse files Browse the repository at this point in the history
This leaks the FD of BPF map which means it will not be freed.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
  • Loading branch information
phrdina committed Jan 13, 2020
1 parent c2642c4 commit 7d60846
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/util/vircgroupv2devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ virCgroupV2DevicesAttachProg(virCgroupPtr group,
VIR_FORCE_CLOSE(group->unified.devices.progfd);
}

if (group->unified.devices.mapfd > 0) {
VIR_DEBUG("Closing existing map that was replaced by new one.");
VIR_FORCE_CLOSE(group->unified.devices.mapfd);
}

group->unified.devices.progfd = progfd;
group->unified.devices.mapfd = mapfd;
group->unified.devices.max = max;
Expand Down

0 comments on commit 7d60846

Please sign in to comment.