* [Qemu-devel] [PATCH] virtio-gpu: use glib alloc/free routines
@ 2013-12-10 4:57 Dave Airlie
0 siblings, 0 replies; only message in thread
From: Dave Airlie @ 2013-12-10 4:57 UTC (permalink / raw)
To: qemu-devel
From: Dave Airlie <airlied@redhat.com>
Oh I forgot to fix these up previously.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
hw/display/virtio-gpu.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 7bf2fbb..28dcd1e 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -137,7 +137,7 @@ static void virtgpu_resource_create_2d(VirtIOGPU *g,
pixman_format_code_t pformat;
struct virtgpu_simple_resource *res;
- res = calloc(1, sizeof(struct virtgpu_simple_resource));
+ res = g_new0(struct virtgpu_simple_resource, 1);
if (!res)
return;
@@ -159,7 +159,7 @@ static void virtgpu_resource_destroy(struct virtgpu_simple_resource *res)
{
pixman_image_unref(res->image);
QLIST_REMOVE(res, next);
- free(res);
+ g_free(res);
}
static void virtgpu_resource_unref(VirtIOGPU *g,
@@ -310,12 +310,10 @@ static void virtgpu_resource_attach_backing(VirtIOGPU *g,
if (!res)
return;
- res_iovs = malloc(att_rb->nr_entries * sizeof(struct iovec));
- if (!res_iovs)
- return;
+ res_iovs = g_new0(struct iovec, att_rb->nr_entries);
if (iov_cnt > 1) {
- data = malloc(gsize);
+ data = g_malloc(gsize);
iov_to_buf(iov, iov_cnt, 0, data, gsize);
} else
data = iov[0].iov_base;
@@ -337,7 +335,7 @@ static void virtgpu_resource_attach_backing(VirtIOGPU *g,
res->iov_cnt = att_rb->nr_entries;
if (iov_cnt > 1)
- free(data);
+ g_free(data);
}
static void virtgpu_resource_inval_backing(VirtIOGPU *g,
@@ -354,7 +352,7 @@ static void virtgpu_resource_inval_backing(VirtIOGPU *g,
for (i = 0; i < res->iov_cnt; i++) {
cpu_physical_memory_unmap(res->iov[i].iov_base, res->iov[i].iov_len, 1, res->iov[i].iov_len);
}
- free(res->iov);
+ g_free(res->iov);
res->iov_cnt = 0;
res->iov = NULL;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-12-10 4:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 4:57 [Qemu-devel] [PATCH] virtio-gpu: use glib alloc/free routines Dave Airlie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).