mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-23 17:19:21 +00:00
fix a double free caused by amdgpu_dri3_get_formats()
The function now allocates memory with malloc() and copies the formats array, instead of returning a pointer to static memory that the xserver would try to free() later.
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xlibre-xf86-video-amdgpu],
|
||||
[25.1.0],
|
||||
[25.1.1],
|
||||
[https://github.com/X11Libre/xf86-video-amdgpu/issues],
|
||||
[xlibre-xf86-video-amdgpu])
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
project(
|
||||
'xf86-video-amdgpu',
|
||||
'c',
|
||||
version: '25.1.0',
|
||||
version: '25.1.1',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.59.0',
|
||||
default_options: ['warning_level=1']
|
||||
|
||||
@@ -829,10 +829,15 @@ amdgpu_dri3_get_formats(ScreenPtr screen, unsigned int *num_formats,
|
||||
DRM_FORMAT_RGB332,
|
||||
DRM_FORMAT_BGR233,
|
||||
};
|
||||
unsigned int count = sizeof(formats_arr) / sizeof(formats_arr[0]);
|
||||
|
||||
*num_formats = sizeof(formats_arr) / sizeof(formats_arr[0]);
|
||||
*formats = (unsigned int *)formats_arr;
|
||||
return sizeof(formats_arr) / sizeof(formats_arr[0]);
|
||||
*formats = malloc(count * sizeof(uint32_t));
|
||||
if (!*formats)
|
||||
return 0;
|
||||
|
||||
memcpy(*formats, formats_arr, count * sizeof(uint32_t));
|
||||
*num_formats = count;
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user