[Spice-devel] [PATCH 04/10] syntax-check: Don't cast free() arguments
Victor Toso
lists at victortoso.com
Wed Oct 7 22:41:47 PDT 2015
Hi,
On Wed, Oct 07, 2015 at 06:45:11PM +0200, Christophe Fergeau wrote:
> ---
> server/red_replay_qxl.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/server/red_replay_qxl.c b/server/red_replay_qxl.c
> index ad1a8fd..7dcfc16 100644
> --- a/server/red_replay_qxl.c
> +++ b/server/red_replay_qxl.c
> @@ -439,9 +439,9 @@ static void red_replay_image_free(SpiceReplay *replay, QXLPHYSICAL p, uint32_t f
>
> switch (qxl->descriptor.type) {
> case SPICE_IMAGE_TYPE_BITMAP:
> - free((void*)qxl->bitmap.palette);
> + free(qxl->bitmap.palette);
I'm getting -Werror=int-conversion here (gcc)
<snip>
red_replay_qxl.c: In function 'red_replay_image_free':
red_replay_qxl.c:442:14: error: passing argument 1 of 'free' makes pointer from integer without a cast [-Werror=int-conversion]
free(qxl->bitmap.palette);
^
</snip>
> if (qxl->bitmap.flags & QXL_BITMAP_DIRECT) {
> - free((void*)qxl->bitmap.data);
> + free(qxl->bitmap.data);
same.
> } else {
> red_replay_data_chunks_free(replay, (void*)qxl->bitmap.data, 0);
> }
> @@ -640,7 +640,7 @@ static void red_replay_stroke_free(SpiceReplay *replay, QXLStroke *qxl, uint32_t
> {
> red_replay_path_free(replay, qxl->path);
> if (qxl->attr.flags & SPICE_LINE_FLAGS_STYLED) {
> - free((void*)qxl->attr.style);
> + free(qxl->attr.style);
same.
> }
> red_replay_brush_free(replay, &qxl->brush, flags);
> }
> @@ -772,9 +772,9 @@ static void red_replay_composite_ptr(SpiceReplay *replay, QXLComposite *qxl, uin
> static void red_replay_composite_free(SpiceReplay *replay, QXLComposite *qxl, uint32_t flags)
> {
> red_replay_image_free(replay, qxl->src, flags);
> - free((void*)qxl->src_transform);
> + free(qxl->src_transform);
> red_replay_image_free(replay, qxl->mask, flags);
> - free((void*)qxl->mask_transform);
> + free(qxl->mask_transform);
>
same.
> }
>
> @@ -1048,7 +1048,7 @@ static void red_replay_surface_cmd_free(SpiceReplay *replay, QXLSurfaceCmd *qxl)
> replay_id_free(replay, qxl->surface_id);
> }
>
> - free((void*)qxl->u.surface_create.data);
> + free(qxl->u.surface_create.data);
same.
> free(qxl);
> }
cheers,
Victor Toso
More information about the Spice-devel
mailing list