[Spice-devel] [PATCH spice-server] spicevmc: Check correctly rcc argument
Frediano Ziglio
fziglio at redhat.com
Thu Jan 26 15:41:24 UTC 2017
>
> Do not check rcc after being use but before.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/spicevmc.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/server/spicevmc.c b/server/spicevmc.c
> index 064910e..df776f4 100644
> --- a/server/spicevmc.c
> +++ b/server/spicevmc.c
> @@ -450,12 +450,11 @@ static void
> spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
> {
> RedVmcChannel *channel;
> SpiceCharDeviceInterface *sif;
> - RedClient *client = red_channel_client_get_client(rcc);
> + RedClient *client;
>
> - if (!rcc) {
> - return;
> - }
> + g_return_if_fail(rcc != NULL);
>
> + client = red_channel_client_get_client(rcc);
> channel = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
>
> /* partial message which wasn't pushed to device */
I prefer the version removing the NULL check.
Frediano
More information about the Spice-devel
mailing list