Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> On Thu, 2017-11-30 at 11:15 +0000, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/tests/test-display-base.c | 42 ++++++++++++++++---- > ------------ > server/tests/test-display-streaming.c | 2 +- > server/tests/test-display-width-stride.c | 4 +-- > server/tests/test-gst.c | 12 ++++----- > server/tests/test-qxl-parsing.c | 18 +++++++------- > server/tests/test-stat-file.c | 4 +-- > 6 files changed, 41 insertions(+), 41 deletions(-) > > diff --git a/server/tests/test-display-base.c b/server/tests/test- > display-base.c > index 83eb92e5..2677eb42 100644 > --- a/server/tests/test-display-base.c > +++ b/server/tests/test-display-base.c > @@ -65,10 +65,10 @@ static void > test_spice_destroy_update(SimpleSpiceUpdate *update) > } > if (update->drawable.clip.type != SPICE_CLIP_TYPE_NONE) { > uint8_t *ptr = (uint8_t*)update->drawable.clip.data; > - free(ptr); > + g_free(ptr); > } > - free(update->bitmap); > - free(update); > + g_free(update->bitmap); > + g_free(update); > } > > #define DEFAULT_WIDTH 640 > @@ -186,7 +186,7 @@ test_spice_create_update_from_bitmap(uint32_t > surface_id, > bh = bbox.bottom - bbox.top; > bw = bbox.right - bbox.left; > > - update = spice_new0(SimpleSpiceUpdate, 1); > + update = g_new0(SimpleSpiceUpdate, 1); > update->bitmap = bitmap; > drawable = &update->drawable; > image = &update->image; > @@ -199,7 +199,7 @@ test_spice_create_update_from_bitmap(uint32_t > surface_id, > } else { > QXLClipRects *cmd_clip; > > - cmd_clip = spice_malloc0(sizeof(QXLClipRects) + > num_clip_rects*sizeof(QXLRect)); > + cmd_clip = g_malloc0(sizeof(QXLClipRects) + > num_clip_rects*sizeof(QXLRect)); > cmd_clip->num_rects = num_clip_rects; > cmd_clip->chunk.data_size = num_clip_rects*sizeof(QXLRect); > cmd_clip->chunk.prev_chunk = cmd_clip->chunk.next_chunk = 0; > @@ -208,7 +208,7 @@ test_spice_create_update_from_bitmap(uint32_t > surface_id, > drawable->clip.type = SPICE_CLIP_TYPE_RECTS; > drawable->clip.data = (intptr_t)cmd_clip; > > - free(clip_rects); > + g_free(clip_rects); > } > drawable->effect = QXL_EFFECT_OPAQUE; > simple_set_release_info(&drawable->release_info, > (intptr_t)update); > @@ -248,7 +248,7 @@ static SimpleSpiceUpdate > *test_spice_create_update_solid(uint32_t surface_id, QX > bw = bbox.right - bbox.left; > bh = bbox.bottom - bbox.top; > > - bitmap = spice_malloc(bw * bh * 4); > + bitmap = g_malloc(bw * bh * 4); > dst = (uint32_t *)bitmap; > > for (i = 0 ; i < bh * bw ; ++i, ++dst) { > @@ -283,7 +283,7 @@ static SimpleSpiceUpdate > *test_spice_create_update_draw(Test *test, uint32_t sur > bw = test->primary_width/SINGLE_PART; > bh = 48; > > - bitmap = dst = spice_malloc(bw * bh * 4); > + bitmap = dst = g_malloc(bw * bh * 4); > //printf("allocated %p\n", dst); > > for (i = 0 ; i < bh * bw ; ++i, dst+=4) { > @@ -308,7 +308,7 @@ static SimpleSpiceUpdate > *test_spice_create_update_copy_bits(Test *test, uint32_ > .top = 0, > }; > > - update = spice_new0(SimpleSpiceUpdate, 1); > + update = g_new0(SimpleSpiceUpdate, 1); > drawable = &update->drawable; > > bw = test->primary_width/SINGLE_PART; > @@ -353,7 +353,7 @@ static int format_to_bpp(int format) > > static SimpleSurfaceCmd *create_surface(int surface_id, int format, > int width, int height, uint8_t *data) > { > - SimpleSurfaceCmd *simple_cmd = spice_new0(SimpleSurfaceCmd, 1); > + SimpleSurfaceCmd *simple_cmd = g_new0(SimpleSurfaceCmd, 1); > QXLSurfaceCmd *surface_cmd = &simple_cmd->surface_cmd; > int bpp = format_to_bpp(format); > > @@ -372,7 +372,7 @@ static SimpleSurfaceCmd *create_surface(int > surface_id, int format, int width, i > > static SimpleSurfaceCmd *destroy_surface(int surface_id) > { > - SimpleSurfaceCmd *simple_cmd = spice_new0(SimpleSurfaceCmd, 1); > + SimpleSurfaceCmd *simple_cmd = g_new0(SimpleSurfaceCmd, 1); > QXLSurfaceCmd *surface_cmd = &simple_cmd->surface_cmd; > > set_cmd(&simple_cmd->ext, QXL_CMD_SURFACE, > (intptr_t)surface_cmd); > @@ -675,14 +675,14 @@ static void release_resource(SPICE_GNUC_UNUSED > QXLInstance *qin, > test_spice_destroy_update((void*)ext); > break; > case QXL_CMD_SURFACE: > - free(ext); > + g_free(ext); > break; > case QXL_CMD_CURSOR: { > QXLCursorCmd *cmd = (QXLCursorCmd *)(uintptr_t)ext- > >cmd.data; > if (cmd->type == QXL_CURSOR_SET || cmd->type == > QXL_CURSOR_MOVE) { > - free(cmd); > + g_free(cmd); > } > - free(ext); > + g_free(ext); > break; > } > default: > @@ -731,8 +731,8 @@ static int get_cursor_command(QXLInstance *qin, > struct QXLCommandExt *ext) > } > > test->cursor_notify--; > - cmd = spice_new0(QXLCommandExt, 1); > - cursor_cmd = spice_new0(QXLCursorCmd, 1); > + cmd = g_new0(QXLCommandExt, 1); > + cursor_cmd = g_new0(QXLCursorCmd, 1); > > cursor_cmd->release_info.id = (uintptr_t)cmd; > > @@ -886,8 +886,8 @@ void test_set_simple_command_list(Test *test, > const int *simple_commands, int nu > { > int i; > > - free(test->commands); > - test->commands = spice_new0(Command, num_commands); > + g_free(test->commands); > + test->commands = g_new0(Command, num_commands); > test->num_commands = num_commands; > for (i = 0 ; i < num_commands; ++i) { > test->commands[i].command = simple_commands[i]; > @@ -923,7 +923,7 @@ static gboolean ignore_bind_failures(const gchar > *log_domain, > > Test* test_new(SpiceCoreInterface* core) > { > - Test *test = spice_new0(Test, 1); > + Test *test = g_new0(Test, 1); > int port = -1; > > test->qxl_instance.base.sif = &display_sif.base; > @@ -965,8 +965,8 @@ void test_destroy(Test *test) > // this timer is used by spice server so > // avoid to free it while is running > test->core->timer_remove(test->wakeup_timer); > - free(test->commands); > - free(test); > + g_free(test->commands); > + g_free(test); > } > > static void init_automated(void) > diff --git a/server/tests/test-display-streaming.c > b/server/tests/test-display-streaming.c > index a881f11e..1cd3f6e5 100644 > --- a/server/tests/test-display-streaming.c > +++ b/server/tests/test-display-streaming.c > @@ -151,7 +151,7 @@ static void create_clipped_frame(Test *test, > Command *command, int clipping_fact > cmd->num_clip_rects = 0; > } else { > cmd->num_clip_rects = 2; > - cmd->clip_rects = calloc(sizeof(QXLRect), 2); > + cmd->clip_rects = g_new0(QXLRect, 2); > cmd->clip_rects[0].left = OVERLAY_WIDTH; > cmd->clip_rects[0].top = cmd->bbox.top; > cmd->clip_rects[0].right = cmd->bbox.right - > clipping_factor; > diff --git a/server/tests/test-display-width-stride.c > b/server/tests/test-display-width-stride.c > index 711cb664..5576f7dd 100644 > --- a/server/tests/test-display-width-stride.c > +++ b/server/tests/test-display-width-stride.c > @@ -64,7 +64,7 @@ set_surface_params(SPICE_GNUC_UNUSED Test *test, > Command *command) > create->format = SPICE_SURFACE_FMT_8_A; > create->width = 128; > create->height = 128; > - g_surface_data = realloc(g_surface_data, create->width * create- > >height * 1); > + g_surface_data = g_realloc(g_surface_data, create->width * > create->height * 1); > create->surface_id = g_surface_id; > create->data = g_surface_data; > } > @@ -73,7 +73,7 @@ static void > set_destroy_parameters(SPICE_GNUC_UNUSED Test *test, > SPICE_GNUC_UNUSED Command *command) > { > if (g_surface_data) { > - free(g_surface_data); > + g_free(g_surface_data); > g_surface_data = NULL; > } > } > diff --git a/server/tests/test-gst.c b/server/tests/test-gst.c > index 69633e39..ecd6c49a 100644 > --- a/server/tests/test-gst.c > +++ b/server/tests/test-gst.c > @@ -585,7 +585,7 @@ handle_pipeline_message(GstBus *bus, GstMessage > *msg, gpointer test_pipeline) > static TestPipeline* > create_pipeline(const char *desc, SampleProc sample_proc, void > *param) > { > - TestPipeline *pipeline = spice_new0(TestPipeline, 1); > + TestPipeline *pipeline = g_new0(TestPipeline, 1); > > pipeline->sample_proc = sample_proc; > pipeline->sample_param = param; > @@ -630,7 +630,7 @@ pipeline_free(TestPipeline *pipeline) > } > gst_object_unref(pipeline->appsink); > gst_object_unref(pipeline->gst_pipeline); > - free(pipeline); > + g_free(pipeline); > } > > static void > @@ -755,7 +755,7 @@ frame_unref(TestFrame *frame) > return; > } > bitmap_free(frame->bitmap); > - free(frame); > + g_free(frame); > } > > static void > @@ -767,7 +767,7 @@ bitmap_free(SpiceBitmap *bitmap) > spice_assert(!bitmap->palette); > spice_assert(bitmap->data); > spice_chunks_destroy(bitmap->data); > - free(bitmap); > + g_free(bitmap); > } > > static SpiceChunks* chunks_alloc(uint32_t stride, uint32_t height, > uint32_t split); > @@ -792,7 +792,7 @@ gst_to_spice_bitmap(GstSample *sample) > spice_assert(gst_structure_get_int(s, "width", &width) && > gst_structure_get_int(s, "height", &height)); > > - SpiceBitmap *bitmap = spice_new0(SpiceBitmap, 1); > + SpiceBitmap *bitmap = g_new0(SpiceBitmap, 1); > bitmap->format = bitmap_format; > bitmap->flags = top_down ? SPICE_BITMAP_FLAGS_TOP_DOWN : 0; > bitmap->x = width; > @@ -953,7 +953,7 @@ get_bitmap_format(const char *format) > static TestFrame * > gst_to_spice_frame(GstSample *sample) > { > - TestFrame *frame = spice_new0(TestFrame, 1); > + TestFrame *frame = g_new0(TestFrame, 1); > frame->refs = 1; > frame->bitmap = gst_to_spice_bitmap(sample); > return frame; > diff --git a/server/tests/test-qxl-parsing.c b/server/tests/test-qxl- > parsing.c > index 9c0c3b1c..47139a48 100644 > --- a/server/tests/test-qxl-parsing.c > +++ b/server/tests/test-qxl-parsing.c > @@ -48,7 +48,7 @@ from_physical(QXLPHYSICAL physical) > static void* > create_chunk(size_t prefix, uint32_t size, QXLDataChunk* prev, int > fill) > { > - uint8_t *ptr = spice_malloc0(prefix + sizeof(QXLDataChunk) + > size); > + uint8_t *ptr = g_malloc0(prefix + sizeof(QXLDataChunk) + size); > QXLDataChunk *qxl = (QXLDataChunk *) (ptr + prefix); > memset(&qxl->data[0], fill, size); > qxl->data_size = size; > @@ -76,13 +76,13 @@ static void init_qxl_surface(QXLSurfaceCmd *qxl) > qxl->u.surface_create.width = 128; > qxl->u.surface_create.stride = 512; > qxl->u.surface_create.height = 128; > - surface_mem = malloc(0x10000); > + surface_mem = g_malloc(0x10000); > qxl->u.surface_create.data = to_physical(surface_mem); > } > > static void deinit_qxl_surface(QXLSurfaceCmd *qxl) > { > - free(from_physical(qxl->u.surface_create.data)); > + g_free(from_physical(qxl->u.surface_create.data)); > } > > static void test_no_issues(void) > @@ -168,8 +168,8 @@ static void test_cursor_command(void) > cursor_cmd.u.set.shape = to_physical(cursor); > > g_assert_true(red_get_cursor_cmd(&mem_info, 0, &red_cursor_cmd, > to_physical(&cursor_cmd))); > - free(red_cursor_cmd.u.set.shape.data); > - free(cursor); > + g_free(red_cursor_cmd.u.set.shape.data); > + g_free(cursor); > memslot_info_destroy(&mem_info); > } > > @@ -210,8 +210,8 @@ static void test_circular_empty_chunks(void) > } > g_test_assert_expected_messages(); > > - free(cursor); > - free(chunks[0]); > + g_free(cursor); > + g_free(chunks[0]); > memslot_info_destroy(&mem_info); > } > > @@ -252,8 +252,8 @@ static void test_circular_small_chunks(void) > } > g_test_assert_expected_messages(); > > - free(cursor); > - free(chunks[0]); > + g_free(cursor); > + g_free(chunks[0]); > memslot_info_destroy(&mem_info); > } > > diff --git a/server/tests/test-stat-file.c b/server/tests/test-stat- > file.c > index 901985a7..e6aef827 100644 > --- a/server/tests/test-stat-file.c > +++ b/server/tests/test-stat-file.c > @@ -38,7 +38,7 @@ static void stat_file(void) > > g_assert_nonnull(stat_file); > g_assert_nonnull(stat_file_get_shm_name(stat_file)); > - filename = strdup(stat_file_get_shm_name(stat_file)); > + filename = g_strdup(stat_file_get_shm_name(stat_file)); > g_assert(access(filename, R_OK)); > > /* fill all nodes */ > @@ -84,7 +84,7 @@ static void stat_file(void) > stat_file_unlink(stat_file); > g_assert_null(stat_file_get_shm_name(stat_file)); > g_assert_cmpint(access(filename, F_OK),==,-1); > - free(filename); > + g_free(filename); > > stat_file_free(stat_file); > } _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel