glamor: avoid double free in glamor_make_pixmap_exportable()

Reported by gcc 15.1:

../glamor/glamor_egl.c:320:9:
 warning: double-‘free’ of ‘modifiers’ [CWE-415] [-Wanalyzer-double-free]
[...]
           │  732 |│        free(*modifiers);
           │      |│        ~~~~~~~~~~~~~~~~
           │      |│        |
           │      |└───────>(25) ...to here
           │      |         (26) first ‘free’ here
[...]
    │  320 |         free(modifiers);
    │      |         ~~~~~~~~~~~~~~~
    │      |         |
    │      |         (28) ⚠️  second ‘free’ here; first ‘free’ was at (26)

Fixes: cef12efc1 ("glamor: Implement GetSupportedModifiers")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
This commit is contained in:
Alan Coopersmith 2025-11-02 12:16:56 -08:00
parent 6a4ec30af4
commit 3e9baa20f3

View file

@ -730,6 +730,7 @@ glamor_get_modifiers(ScreenPtr screen, uint32_t format,
if (!eglQueryDmaBufModifiersEXT(glamor_egl->display, format, num, if (!eglQueryDmaBufModifiersEXT(glamor_egl->display, format, num,
(EGLuint64KHR *) *modifiers, NULL, &num)) { (EGLuint64KHR *) *modifiers, NULL, &num)) {
free(*modifiers); free(*modifiers);
*modifiers = NULL;
return FALSE; return FALSE;
} }