st/vdpau: fix two small memory leaks
authorChristian König <deathsimple@vodafone.de>
Wed, 7 Mar 2012 13:51:46 +0000 (14:51 +0100)
committerChristian König <deathsimple@vodafone.de>
Fri, 9 Mar 2012 11:44:34 +0000 (12:44 +0100)
Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/vdpau/output.c

index 5af1570d5aef33f420912ced4962102c0d29e9a2..2e38f6cdadb51da486c67b127c37200fc570f66d 100644 (file)
@@ -292,8 +292,8 @@ vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, str
       struct pipe_sampler_view sv_templ;
 
       vlVdpDefaultSamplerViewTemplate(&sv_templ, res);
-      pipe_sampler_view_reference(&vlsurface->sampler_view,
-         dev->context->create_sampler_view(dev->context, res, &sv_templ));
+      pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
+      vlsurface->sampler_view = dev->context->create_sampler_view(dev->context, res, &sv_templ);
    }
 
    return;
index 7e3d74d801191ea580260703bca8d68964610a24..5b25e63d28e48703dd382563619b638be6922862 100644 (file)
@@ -133,16 +133,20 @@ VdpStatus
 vlVdpOutputSurfaceDestroy(VdpOutputSurface surface)
 {
    vlVdpOutputSurface *vlsurface;
+   struct pipe_context *pipe;
 
    vlsurface = vlGetDataHTAB(surface);
    if (!vlsurface)
       return VDP_STATUS_INVALID_HANDLE;
 
+   pipe = vlsurface->device->context;
+
    pipe_mutex_lock(vlsurface->device->mutex);
    vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
 
    pipe_surface_reference(&vlsurface->surface, NULL);
    pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
+   pipe->screen->fence_reference(pipe->screen, &vlsurface->fence, NULL);
    vl_compositor_cleanup_state(&vlsurface->cstate);
    pipe_mutex_unlock(vlsurface->device->mutex);