[Spice-devel] [PATCH spice-server v2 05/23] stream: Use GLib memory functions
Frediano Ziglio
fziglio at redhat.com
Wed Sep 20 07:50:58 UTC 2017
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/dcc.c | 2 +-
server/stream.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/server/dcc.c b/server/dcc.c
index 3bf75a707..aa222b09a 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -635,7 +635,7 @@ void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
item->clip_type = SPICE_CLIP_TYPE_RECTS;
n_rects = pixman_region32_n_rects(&agent->clip);
- item->rects = spice_malloc_n_m(n_rects, sizeof(SpiceRect), sizeof(SpiceClipRects));
+ item->rects = g_malloc(n_rects * sizeof(SpiceRect) + sizeof(SpiceClipRects));
item->rects->num_rects = n_rects;
region_ret_rects(&agent->clip, item->rects->rects, n_rects);
diff --git a/server/stream.c b/server/stream.c
index 71755ea1f..e674161a1 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -169,7 +169,7 @@ static void red_stream_clip_item_free(RedPipeItem *base)
g_return_if_fail(item->base.refcount == 0);
stream_agent_unref(display, item->stream_agent);
- free(item->rects);
+ g_free(item->rects);
g_free(item);
}
@@ -777,7 +777,7 @@ static void red_upgrade_item_free(RedPipeItem *base)
g_return_if_fail(item->base.refcount == 0);
drawable_unref(item->drawable);
- free(item->rects);
+ g_free(item->rects);
g_free(item);
}
@@ -825,7 +825,7 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
upgrade_item->drawable = stream->current;
upgrade_item->drawable->refs++;
n_rects = pixman_region32_n_rects(&upgrade_item->drawable->tree_item.base.rgn);
- upgrade_item->rects = spice_malloc_n_m(n_rects, sizeof(SpiceRect), sizeof(SpiceClipRects));
+ upgrade_item->rects = g_malloc(n_rects * sizeof(SpiceRect) + sizeof(SpiceClipRects));
upgrade_item->rects->num_rects = n_rects;
region_ret_rects(&upgrade_item->drawable->tree_item.base.rgn,
upgrade_item->rects->rects, n_rects);
--
2.13.5
More information about the Spice-devel
mailing list