Module: wine Branch: master Commit: 7d013ed86cd82c50f813f2e7ef2145ed04b805db URL: https://gitlab.winehq.org/wine/wine/-/commit/7d013ed86cd82c50f813f2e7ef2145e...
Author: Alexandre Julliard julliard@winehq.org Date: Sun Aug 20 12:45:35 2023 +0200
winex11: Work around a false positive gcc warning.
---
dlls/winex11.drv/clipboard.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 6f233418105..087e0aab79b 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -1850,7 +1850,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop, { int aformat; unsigned long pos = 0, nitems, remain, count; - unsigned char *val = NULL, *buffer; + unsigned char *val = NULL, *new_val, *buffer;
for (;;) { @@ -1863,15 +1863,13 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop, }
count = get_property_size( aformat, nitems ); - *data = realloc( val, pos * sizeof(int) + count + 1 ); - - if (!*data) + if (!(new_val = realloc( val, pos * sizeof(int) + count + 1 ))) { XFree( buffer ); free( val ); return FALSE; } - val = *data; + val = new_val; memcpy( (int *)val + pos, buffer, count ); XFree( buffer ); if (!remain) @@ -1889,6 +1887,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop, /* Delete the property on the window now that we are done * This will send a PropertyNotify event to the selection owner. */ XDeleteProperty(display, w, prop); + *data = val; return TRUE; }