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

Christophe Fergeau cfergeau at redhat.com
Tue Apr 17 16:11:36 UTC 2018


On Mon, Apr 16, 2018 at 06:51:52PM +0300, Uri Lublin wrote:
> On 04/16/2018 01:13 PM, Christophe Fergeau 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);
> 
> Hi Christophe,
> 
> Would it not be better to do the check in red_qxl_release_resource ?
> (and also set ".info" to NULL after it is released)

After implementing Frediano's suggestion, this test is gone ;)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180417/d31f4a96/attachment.sig>


More information about the Spice-devel mailing list