From ba0eb230836fa5f94a2f50da5880fdd3b9dfd72e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 1 Jun 2012 23:22:31 +0100 Subject: uxa: Fix reallocation of XVAdaptors array Prevent the leak and remove some unsightly code in the process. Reported-by: Zdenek Kabelac Signed-off-by: Chris Wilson --- src/intel_video.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/intel_video.c b/src/intel_video.c index 83d1eabd..09674e50 100644 --- a/src/intel_video.c +++ b/src/intel_video.c @@ -337,13 +337,12 @@ void I830InitVideo(ScreenPtr screen) /* Give our adaptor list enough space for the overlay and/or texture video * adaptors. */ - newAdaptors = - malloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *)); - if (newAdaptors == NULL) + newAdaptors = realloc(adaptors, + (num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr)); + if (newAdaptors == NULL) { + free(adaptors); return; - - memcpy(newAdaptors, adaptors, - num_adaptors * sizeof(XF86VideoAdaptorPtr)); + } adaptors = newAdaptors; /* Add the adaptors supported by our hardware. First, set up the atoms -- cgit v1.2.1