diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2011-08-01 10:05:30 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2011-08-01 10:05:30 -0400 |
commit | 104b2d7c071f29266b1bc4184a74e9714d14febc (patch) | |
tree | 6bb1e0c5a863e5d6d2db662bafc594e0ee26f6ab /src | |
parent | d29bab632e9ecccba518d4107d52620bf75eb1cf (diff) |
kms: fix possible leak in pageflip code
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/drmmode_display.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 7f6ce181..f49aa3dc 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1654,7 +1654,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, struct radeon_bo *new_front, void *dat unsigned int pitch; int i, old_fb_id; uint32_t tiling_flags = 0; - int height; + int height, emitted = 0; drmmode_flipdata_ptr flipdata; drmmode_flipevtcarrier_ptr flipcarrier; @@ -1708,6 +1708,8 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, struct radeon_bo *new_front, void *dat if (!flipcarrier) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue: carrier alloc failed.\n"); + if (emitted == 0) + free(flipdata); goto error_undo; } @@ -1722,8 +1724,11 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, struct radeon_bo *new_front, void *dat xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed: %s\n", strerror(errno)); free(flipcarrier); + if (emitted == 0) + free(flipdata); goto error_undo; } + emitted++; } flipdata->old_fb_id = old_fb_id; |