All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] usb/desc-msos: using g_free instead of free in usb_desc_msos()
@ 2015-01-19  3:42 arei.gonglei
  2015-01-19  7:27 ` Gerd Hoffmann
  0 siblings, 1 reply; 2+ messages in thread
From: arei.gonglei @ 2015-01-19  3:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Gonglei, kraxel

From: Gonglei <arei.gonglei@huawei.com>

It's important to match g_malloc() with g_free(), plain
malloc() with free(). Otherwise bad things can happen,
since these allocators may use different memory pools.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 hw/usb/desc-msos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/desc-msos.c b/hw/usb/desc-msos.c
index 334d1ae..32c3600 100644
--- a/hw/usb/desc-msos.c
+++ b/hw/usb/desc-msos.c
@@ -231,7 +231,7 @@ int usb_desc_msos(const USBDesc *desc,  USBPacket *p,
         length = len;
     }
     memcpy(dest, buf, length);
-    free(buf);
+    g_free(buf);
 
     p->actual_length = length;
     return 0;
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] usb/desc-msos: using g_free instead of free in usb_desc_msos()
  2015-01-19  3:42 [Qemu-devel] [PATCH] usb/desc-msos: using g_free instead of free in usb_desc_msos() arei.gonglei
@ 2015-01-19  7:27 ` Gerd Hoffmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2015-01-19  7:27 UTC (permalink / raw)
  To: arei.gonglei; +Cc: qemu-trivial, qemu-devel

On Mo, 2015-01-19 at 11:42 +0800, arei.gonglei@huawei.com wrote:
> It's important to match g_malloc() with g_free(), plain
> malloc() with free(). Otherwise bad things can happen,
> since these allocators may use different memory pools.

added to usb queue.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-19  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19  3:42 [Qemu-devel] [PATCH] usb/desc-msos: using g_free instead of free in usb_desc_msos() arei.gonglei
2015-01-19  7:27 ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.