Commit 4aac4e7c authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

winex11: Fix memory leak on realloc failure in import_xdnd_selection (cppcheck).

parent e7ba00c7
......@@ -1285,7 +1285,7 @@ struct format_entry *import_xdnd_selection( Display *display, Window win, Atom s
UINT i;
void *data;
struct clipboard_format *format;
struct format_entry *ret = NULL, *entry;
struct format_entry *ret = NULL, *tmp, *entry;
BOOL have_hdrop = FALSE;
register_x11_formats( targets, count );
......@@ -1310,7 +1310,8 @@ struct format_entry *import_xdnd_selection( Display *display, Window win, Atom s
entry_size = (FIELD_OFFSET( struct format_entry, data[size] ) + 7) & ~7;
if (buf_size < size + entry_size)
{
if (!(ret = realloc( ret, *ret_size + entry_size + 1024 ))) continue;
if (!(tmp = realloc( ret, *ret_size + entry_size + 1024 ))) continue;
ret = tmp;
buf_size = *ret_size + entry_size + 1024; /* extra space for following entries */
}
entry = (struct format_entry *)((char *)ret + *ret_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment