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>
This commit is contained in:
parent
affb1f82c1
commit
ba0eb23083
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue