fix segfault while flushing unresponsive devices

The bug is that flush_db modifies the list while it is being iterated.
While we can fix this easily in mapper_db_flush(), by simply getting
the pointer to the next item before the current item is freed, it is
harder to do so during mapper_monitor_poll(), which can trigger the
MDB_UNRESPONSIVE callback.  In this case, testmonitor.c calls out to
mapper_monitor_flush_db(), which flushes items from the list while
iterating the same list.

In this patch, I've removed the call to mapper_monitor_flush_db() and
added it to the end of mapper_monitor_poll() instead, on the
assumption that we do not want the onus of calling flush_db() to be on
the user code.  This warrants discussion.  For instance, the user can
no longer specify the desired timeout for devices.  (It could be
provided to mapper_monitor_poll(), or made a parameter memorized by
the monitor.)

Note: Segfault occurs reliably on Linux x86_64.  Not observed using
Mac OS X.