[Spice-devel] [PATCH 5/9] server: dispatcher_init/dispatcher_new

Christophe Fergeau cfergeau at redhat.com
Wed Oct 21 06:34:37 PDT 2015


On Wed, Oct 21, 2015 at 08:37:25AM -0400, Frediano Ziglio wrote:
> 
> > 
> > From: Marc-André Lureau <marcandre.lureau at gmail.com>
> > 
> > ---
> >  server/red_dispatcher.c | 6 ++++--
> >  server/red_dispatcher.h | 2 +-
> >  server/reds.c           | 2 +-
> >  3 files changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
> > index 0bc853d..c43da7d 100644
> > --- a/server/red_dispatcher.c
> > +++ b/server/red_dispatcher.c
> > @@ -1060,7 +1060,7 @@ static RedChannel
> > *red_dispatcher_cursor_channel_create(RedDispatcher *dispatche
> >      return cursor_channel;
> >  }
> >  
> > -void red_dispatcher_init(QXLInstance *qxl)
> > +RedDispatcher *red_dispatcher_new(QXLInstance *qxl)
> >  {
> >      RedDispatcher *red_dispatcher;
> >      WorkerInitData init_data;
> > @@ -1069,7 +1069,7 @@ void red_dispatcher_init(QXLInstance *qxl)
> >      RedChannel *cursor_channel;
> >      ClientCbs client_cbs = { NULL, };
> >  
> > -    spice_return_if_fail(qxl->st->dispatcher == NULL);
> > +    spice_return_val_if_fail(qxl->st->dispatcher == NULL, NULL);
> > 
> 
> This is just going to leak the old dispatcher if already set, see below.
> This should be an assert.

If spice_return_val_if_fail() are anything like g_return_val_if_fail(),
they usually mean "programming error, anything may happen from this
point". If there's only a minor leak when this occurs, this is fair game
imo, and better than an assert().

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151021/412c2e82/attachment.sig>


More information about the Spice-devel mailing list