Skip to contentSkip to conversation

fix few small memory leaks in qemu

PATCH In review Stefano Stabellini 2 participants 2 messages Oct 21, 2009 – Oct 22, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix few small memory leaks in qemu

Hi all,
running qemu with valgrind I found few small memory leaks, this patch fixes them.

---

hw/vga.c +1 -0
index 90bd544..ccbcda9 100644
@@ -2538,6 +2538,7 @@ void xen_vga_vram_map(uint64_t vram_addr, uint32_t vga_ram_size)
 #ifdef CONFIG_STUBDOM
     xenfb_pv_display_vram(vram);
 #endif
+    free(pfn_list);
 }
 
 /* when used on xen environment, the vga_ram_base is not used */
xenstore.c +5 -1
index da278f4..2133cea 100644
@@ -709,7 +709,7 @@ static void xenstore_process_logdirty_event(void)
     act = xs_read(xsh, XBT_NULL, cmd_path, &len);
     if (!act) {
         fprintf(logfile, "Log-dirty: no command yet.\n");
-        return;
+        goto out;
     }
     fprintf(logfile, "Log-dirty command %s\n", act);
 
@@ -724,7 +724,11 @@ static void xenstore_process_logdirty_event(void)
 
     /* Ack that we've service the command */
     xs_write(xsh, XBT_NULL, ret_path, act, len);
+
     free(act);
+out:
+    free(ret_path);
+    free(cmd_path);
 }
#1 lore raw

Stefano Stabellini writes ("[Xen-devel] [PATCH] fix few small memory leaks in qemu"):

Quoted 2 lines

running qemu with valgrind I found few small memory leaks, this patch fixes them.

Well done. I take it this is a candidate for a 3.4 backport.

Ian.