XlibInt: info_list->watch_data was reallocated, but result was discarded

info_list->watch_data was being reallocated, but the return value of
the reallocation was stored only into a local variable. This might
cause some funky behavior and crashes.

Variable "wd_array" goes out of scope
Value "wd_array" is overwritten in "wd_array = (XPointer*)realloc((char*)info_list->watch_data, (((dpy->watcher_count + 1) * 4U == 0U) ? 1U : ((dpy->watcher_count + 1) * 4U)))"

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Ander Conselvan de Oliveira 2011-01-31 14:02:12 +02:00 committed by Alan Coopersmith
parent 2b16a7e683
commit 2ace8d5c89

View file

@ -662,6 +662,7 @@ XAddConnectionWatch(
UnlockDisplay(dpy);
return 0;
}
info_list->watch_data = wd_array;
wd_array[dpy->watcher_count] = NULL; /* for cleanliness */
}