[Spice-devel] [PATCH] fixup! replay: Record allocations in a GList to handle errors

Frediano Ziglio fziglio at redhat.com
Tue Sep 20 13:13:06 UTC 2016


> 
> ---
>  server/red-replay-qxl.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> index 7eddaf4..9c3df70 100644
> --- a/server/red-replay-qxl.c
> +++ b/server/red-replay-qxl.c
> @@ -1220,7 +1220,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt*
> spice_replay_next_cmd(SpiceReplay *replay,
>              replay_handle_dev_input(worker, replay, type);
>          }
>      }
> -    cmd = g_new(QXLCommandExt, 1);
> +    cmd = replay_malloc0(replay, sizeof(QXLCommandExt));
>      cmd->cmd.type = type;
>      cmd->group_id = 0;
>      spice_debug("command %"PRIu64", %d\r", timestamp, cmd->cmd.type);
> @@ -1275,9 +1275,6 @@ error:
>          g_list_free_full(replay->allocated, free);
>          replay->allocated = NULL;
>      }
> -    if (cmd) {
> -        g_free(cmd);
> -    }
>      return NULL;
>  }
>  

I'll merge. I think we need to replace the other g_free with free too.

Frediano


More information about the Spice-devel mailing list