Skip to contentSkip to conversation

xl: free bitmaps on exit

PATCH Superseded Olaf Hering 2 participants 3 messages Nov 26, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: free bitmaps on exit

Every invocation of xl via valgrind will show three leaks. Since libxl_bitmap_alloc uses NOGC, the caller has to free the memory after use.

---
 tools/xl/xl.c | 3 +++
 1 file changed, 3 insertions(+)
tools/xl/xl.c +3 -0
index 7d2142f16f..9756a83526 100644
@@ -229,6 +229,9 @@ static void parse_global_config(const char *configfile,
     else
         libxl_bitmap_set_any(&global_pv_affinity_mask);
 
+    libxl_bitmap_dispose(&global_pv_affinity_mask);
+    libxl_bitmap_dispose(&global_hvm_affinity_mask);
+    libxl_bitmap_dispose(&global_vm_affinity_mask);
     xlu_cfg_destroy(config);
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw

Am Mon, 26 Nov 2018 15:58:22 +0100
schrieb Olaf Hering <[email protected]>:

Review static void parse_global_config(const char *configfile,

Quoted 2 lines

+++ b/tools/xl/xl.c

(quoted diff) +0 -0
@@ -229,6 +229,9 @@ static void parse_global_config(const char *configfile,

Actually I think that should go to xl_ctx_free() instead. I moved it down to parse_global_config() by accident.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 7 lines · Olaf Hering

Am Mon, 26 Nov 2018 15:58:22 +0100
schrieb Olaf Hering <[email protected]>:

Review static void parse_global_config(const char *configfile,

Quoted 2 lines

+++ b/tools/xl/xl.c

(quoted diff) +0 -0
@@ -229,6 +229,9 @@ static void parse_global_config(const char *configfile,

Actually I think that should go to xl_ctx_free() instead. I moved it down to parse_global_config() by accident.

You can't just put the _dispose into xl_ctx_free. Because xl_ctx_free can be called before calling parse_global_config. You also need to put the _init calls into xl_ctx_alloc.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel