When using GCC 12, there's two bogus warnings in Wine's code:
../wine-git/dlls/winex11.drv/clipboard.c: In function
‘X11DRV_CLIPBOARD_GetProperty’:
../wine-git/dlls/winex11.drv/clipboard.c:1871:13: error: pointer ‘val’ may be
used after ‘realloc’ [-Werror=use-after-free]
1871 | free( val );
| ^~~~~~~~~~~
../wine-git/dlls/winex11.drv/clipboard.c:1866:17: note: call to ‘realloc’ here
1866 | *data = realloc( val, pos * sizeof(int) + count + 1 );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is no real issue here, it's just a false positive.
This could be worked around using a temporary void* variable to hold the
result from realloc.
Is this worth it or would you wait for gcc to fix their warning?
Regards,
Fabian Maurer