Skip to contentSkip to conversation

: xl: fix double free of domain names

PATCH New Gianni Tedesco 1 participant 1 message Sep 10, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : xl: fix double free of domain names

Assigning malloc'd variables from one structure to another when both of them are free'd via destructors is a bad idea. Let's use a strdup.

tools/libxl/xl_cmdimpl.c +1 -1
diff -r ef2d0a9b2036 tools/libxl/xl_cmdimpl.c
@@ -296,7 +296,7 @@ static void init_dm_info(libxl_device_mo
 
     libxl_uuid_generate(&dm_info->uuid);
 
-    dm_info->dom_name = c_info->name;
+    dm_info->dom_name = strdup(c_info->name);
     dm_info->device_model = strdup("qemu-dm");
     dm_info->videoram = b_info->video_memkb / 1024;
     dm_info->apic = b_info->u.hvm.apic;