]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vircgroupv2devices: free BPF map when replacing with new one v6.0.0-rc2
authorPavel Hrdina <phrdina@redhat.com>
Mon, 13 Jan 2020 11:50:41 +0000 (12:50 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 13 Jan 2020 14:17:54 +0000 (15:17 +0100)
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>
src/util/vircgroupv2devices.c

index 402ce3f86fbf274494d2179968cf9fdeae4ee90a..445f9c53fcaaba41bee2f0951832d89105a948f1 100644 (file)
@@ -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;