vl.c: fix memory leak spotted by valgrind
valgrind complains about:
==42062== 16 bytes in 1 blocks are definitely lost in loss record 387 of 1,048
==42062== at 0x402DCB2: malloc (vg_replace_malloc.c:299) ==42062== by 0x40C1BE3: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x40DA133: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x40DB2E5: g_slist_prepend (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x801637FF: object_class_get_list_tramp (object.c:690) ==42062== by 0x40A96C9: g_hash_table_foreach (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x80164885: object_class_foreach (object.c:665) ==42062== by 0x80164975: object_class_get_list (object.c:698) ==42062== by 0x800100A5: machine_parse (vl.c:2447) ==42062== by 0x800100A5: main (vl.c:3756)
Lets free machines in case of mc.
Signed-off-by Christian Borntraeger <[email protected]>
--- vl.c | 1 + 1 file changed, 1 insertion(+)
vl.c +1 -0
@@ -2450,6 +2450,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b) mc =find_machine (name); }if (mc) { +g_slist_free (machines);return mc; }if (name && !is_help_option (name)) {
Signature · 1 line
1.9.3
Paolo Bonzini
Reviewed-byReviewed-by Paolo Bonzini <[email protected]>
and Ccing qemu-trivial. Funny that we do the g_slist_free before exiting!
Paolo
Quoted 33 lines · Christian Borntraeger
valgrind complains about:
==42062== 16 bytes in 1 blocks are definitely lost in loss record 387 of 1,048==42062== at 0x402DCB2: malloc (vg_replace_malloc.c:299) ==42062== by 0x40C1BE3: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x40DA133: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x40DB2E5: g_slist_prepend (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x801637FF: object_class_get_list_tramp (object.c:690) ==42062== by 0x40A96C9: g_hash_table_foreach (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x80164885: object_class_foreach (object.c:665) ==42062== by 0x80164975: object_class_get_list (object.c:698) ==42062== by 0x800100A5: machine_parse (vl.c:2447) ==42062== by 0x800100A5: main (vl.c:3756)Lets free machines in case of mc.
Signed-off-by Christian Borntraeger <[email protected]>--- vl.c | 1 + 1 file changed, 1 insertion(+)vl.c +1
-0@@ -2450,6 +2450,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b) mc =find_machine (name); }if (mc) { +g_slist_free (machines);return mc; }if (name && !is_help_option (name)) {
Michael Tokarev
AppliedQuoted 1 line · Paolo Bonzini
Reviewed-by Paolo Bonzini <[email protected]>
Applied to -trivial, thank you!
/mjt
Quoted 35 lines · Christian Borntraeger
Quoted 33 lines
valgrind complains about:
==42062== 16 bytes in 1 blocks are definitely lost in loss record 387 of 1,048==42062== at 0x402DCB2: malloc (vg_replace_malloc.c:299) ==42062== by 0x40C1BE3: g_malloc (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x40DA133: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x40DB2E5: g_slist_prepend (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x801637FF: object_class_get_list_tramp (object.c:690) ==42062== by 0x40A96C9: g_hash_table_foreach (in /usr/lib64/libglib-2.0.so.0.3800.2) ==42062== by 0x80164885: object_class_foreach (object.c:665) ==42062== by 0x80164975: object_class_get_list (object.c:698) ==42062== by 0x800100A5: machine_parse (vl.c:2447) ==42062== by 0x800100A5: main (vl.c:3756)Lets free machines in case of mc.
Signed-off-by Christian Borntraeger <[email protected]>--- vl.c | 1 + 1 file changed, 1 insertion(+)vl.c +1
-0@@ -2450,6 +2450,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b) mc =find_machine (name); }if (mc) { +g_slist_free (machines);return mc; }if (name && !is_help_option (name)) {