diff options
author | Michel Dänzer <daenzer@vmware.com> | 2011-01-18 10:23:41 +0100 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2011-01-18 10:54:58 +0100 |
commit | 6548bb9836253c586023ffe5ad1497ddabaa50fc (patch) | |
tree | 44ce11e60b9a94215505ea68a722bec423f2735a /src/radeon_video.c | |
parent | edc3496b55577ee8509ddd9188e6f2bcdf7169a1 (diff) |
Fix KMS textured video leaks (bug #33193).
v2: Fix radeon_legacy_free_memory() argument type error pointed out by
Marton Balint, refactor video memory freeing logic into helper function.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=33193 .
Diffstat (limited to 'src/radeon_video.c')
-rw-r--r-- | src/radeon_video.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/radeon_video.c b/src/radeon_video.c index 0bb5ab3b..4355f8bb 100644 --- a/src/radeon_video.c +++ b/src/radeon_video.c @@ -1646,6 +1646,23 @@ RADEONSetupImageVideo(ScreenPtr pScreen) } void +RADEONFreeVideoMemory(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + if (pPriv->video_memory != NULL) { + radeon_legacy_free_memory(pScrn, pPriv->video_memory); + pPriv->video_memory = NULL; + + if (info->cs && pPriv->textured) { + pPriv->src_bo[0] = NULL; + radeon_legacy_free_memory(pScrn, (void*)&pPriv->src_bo[1]); + pPriv->src_bo[1] = NULL; + } + } +} + +void RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1654,10 +1671,7 @@ RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) if (pPriv->textured) { if (cleanup) { - if (pPriv->video_memory != NULL) { - radeon_legacy_free_memory(pScrn, pPriv->video_memory); - pPriv->video_memory = NULL; - } + RADEONFreeVideoMemory(pScrn, pPriv); } return; } @@ -1679,10 +1693,7 @@ RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) if(pPriv->uda1380 != NULL) xf86_uda1380_mute(pPriv->uda1380, TRUE); if(pPriv->i2c != NULL) RADEON_board_setmisc(pPriv); } - if (pPriv->video_memory != NULL) { - radeon_legacy_free_memory(pScrn, pPriv->video_memory); - pPriv->video_memory = NULL; - } + RADEONFreeVideoMemory(pScrn, pPriv); pPriv->videoStatus = 0; } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { @@ -3152,10 +3163,7 @@ RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now) } } else { /* FREE_TIMER */ if(pPriv->freeTime < now) { - if (pPriv->video_memory != NULL) { - radeon_legacy_free_memory(pScrn, pPriv->video_memory); - pPriv->video_memory = NULL; - } + RADEONFreeVideoMemory(pScrn, pPriv); pPriv->videoStatus = 0; info->VideoTimerCallback = NULL; } |