summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-01 23:22:31 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-02 08:38:21 +0100
commitba0eb230836fa5f94a2f50da5880fdd3b9dfd72e (patch)
tree89cb56e40da7617e78fa863a6a87584d2e6a0d5e
parentaffb1f82c1401bac3f54654a342e3b16b8bd374b (diff)
downloadxorg-driver-xf86-video-intel-ba0eb230836fa5f94a2f50da5880fdd3b9dfd72e.tar.gz
uxa: Fix reallocation of XVAdaptors array
Prevent the leak and remove some unsightly code in the process. Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/intel_video.c11
1 files 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