Re: [PATCH spice-server] spicevmc: Check correctly rcc argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 26, 2017 at 10:41:24AM -0500, Frediano Ziglio wrote:
> > 
> > Do not check rcc after being use but before.
> > 
> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > ---
> >  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);

g_return_if_fail() seems fine to me so that we get a log if something we
don't expect happens. This could even be
g_return_if_fail(RED_IS_CHANNEL_CLIENT(rcc));

No checks would indeed be better than the current if (!rcc) if this is
not supposed to happen.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]