Commit 6ab43fdc31e25b114eec1f3ee25264b5f6a1a0f3
1 parent
70f23b77
Avoid SEGV in IOHandler dispatch, by Daniel P. Berrange.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3132 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
2 additions
and
4 deletions
vl.c
... | ... | @@ -6823,12 +6823,10 @@ void main_loop_wait(int timeout) |
6823 | 6823 | IOHandlerRecord **pioh; |
6824 | 6824 | |
6825 | 6825 | for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { |
6826 | - if (ioh->deleted) | |
6827 | - continue; | |
6828 | - if (FD_ISSET(ioh->fd, &rfds)) { | |
6826 | + if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { | |
6829 | 6827 | ioh->fd_read(ioh->opaque); |
6830 | 6828 | } |
6831 | - if (FD_ISSET(ioh->fd, &wfds)) { | |
6829 | + if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { | |
6832 | 6830 | ioh->fd_write(ioh->opaque); |
6833 | 6831 | } |
6834 | 6832 | } | ... | ... |