Fix use-after-free in VDPAU overlay rendering

This commit is contained in:
Cameron Gutman 2020-12-18 19:39:24 -06:00
parent 027c8dcd41
commit dcbf5affda

View file

@ -385,9 +385,6 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type)
return;
}
// Surface data is no longer needed
SDL_FreeSurface(newSurface);
VdpRect overlayRect;
if (type == Overlay::OverlayStatusUpdate) {
@ -404,6 +401,9 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type)
overlayRect.x1 = overlayRect.x0 + newSurface->w;
overlayRect.y1 = overlayRect.y0 + newSurface->h;
// Surface data is no longer needed
SDL_FreeSurface(newSurface);
SDL_LockMutex(m_OverlayMutex);
m_OverlaySurface[type] = newBitmapSurface;
m_OverlayRect[type] = overlayRect;