Skip to content

Conversation

@GermanAizek
Copy link
Contributor

Hotfix related to issue: #1413

Changes:

  • Result of dri2_probe_driver_name is saved to the temporary variable driver_name
  • ds->driverNames[0] always gets this pointer
  • ds->driverNames[1] gets either the string literal "va_gl" or the same pointer driver_name

Changes:
- Result of dri2_probe_driver_name is saved to the temporary variable driver_name
- ds->driverNames[0] always gets this pointer
- ds->driverNames[1] gets either the string literal "va_gl" or the same pointer driver_name
@algrid
Copy link

algrid commented Nov 17, 2025

It looks like you just introduced a temporary variable keeping the logic intact. What exactly fixes the leak there? Am I missing something?

@stefan11111
Copy link
Contributor

It looks like you just introduced a temporary variable keeping the logic intact. What exactly fixes the leak there? Am I missing something?

I don't see any fix either.

The fix would be to always allocate the driverNames string on th heap and free it after it's used.

@GermanAizek I doubt these few bytes that get leaked when the screen is initialized are enough to be detected.
Are you sure that the linked issues isn't about something else?

@cepelinas9000
Copy link
Contributor

cepelinas9000 commented Nov 18, 2025

@Stefan @algrid strdup in the DRI2ScreenInit leaks - something like 8 bytes per restart and contributes to noise in memleak report:

Direct leak of 48 byte(s) in 6 object(s) allocated from:
    #0 0x7ffff791c9db in strdup /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_interceptors.cpp:593
    #1 0x555555b61e71 in dri2_probe_driver_name ../hw/xfree86/dri2/dri2.c:1477
    #2 0x555555b61e71 in DRI2ScreenInit ../hw/xfree86/dri2/dri2.c:1614
    #3 0x7ffff655bfb0 in ms_dri2_screen_init ../hw/xfree86/drivers/video/modesetting/dri2.c:1101
    #4 0x7ffff655ee37 in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2122
    #5 0x5555556dcf39 in AddScreen ../dix/dispatch.c:4124
    #6 0x555555a2ca9c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #7 0x5555556eabe4 in dix_main ../dix/main.c:198
    #8 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #9 0x7fffffffde69  ([stack]+0x27e69)

@GermanAizek suggest to refactor to work with all names

note: i'm using nvidia modeset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak after active switching between graphic and text TTY

4 participants