On Mon, Jan 13, 2020 at 14:20:26 +0100, Pavel Hrdina wrote:
This leaks the FD of BPF map which means it will not be freed.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/vircgroupv2devices.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c
index 402ce3f86f..445f9c53fc 100644
--- a/src/util/vircgroupv2devices.c
+++ b/src/util/vircgroupv2devices.c
@@ -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;
Reviewed-by: Jiri Denemark <jdenemar(a)redhat.com>