Re: [spice-server 04/10] qxl: Fix guest resources release in red_put_drawable()

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

 



On Mon, Apr 16, 2018 at 07:25:19AM -0400, Frediano Ziglio wrote:
> > 
> > At the moment, we'll unconditionally release the guest QXL resources in
> > red_put_drawable() even if red_get_drawable() failed and did not
> > initialize drawable->release_info_ext properly.
> > This commit checks the QXLReleaseInfo in release_info_ext is non-0
> > before attempting to release it.
> > ---
> >  server/red-parse-qxl.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
> > index dc99d1f30..80746ecbb 100644
> > --- a/server/red-parse-qxl.c
> > +++ b/server/red-parse-qxl.c
> > @@ -1504,7 +1504,9 @@ void red_drawable_unref(RedDrawable *red_drawable)
> >      if (--red_drawable->refs) {
> >          return;
> >      }
> > -    red_qxl_release_resource(red_drawable->qxl,
> > red_drawable->release_info_ext);
> > +    if (red_drawable->release_info_ext.info != NULL) {
> > +        red_qxl_release_resource(red_drawable->qxl,
> > red_drawable->release_info_ext);
> > +    }
> >      red_put_drawable(red_drawable);
> >      g_free(red_drawable);
> >  }
> 
> Would not be better not calling red_qxl_release_resource from red_put_drawable and check
> red->qxl instead of red_drawable->release_info_ext.info != NULL like all other calls?

This would need a bit more changes as red_get_drawable() does not have
a QXLInstance argument, I'll try to add one.

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]