base/workers: Assign worker process list len defensively

When we remove a worker, we know there are 'j' workers left in
the list, so in case we've managed to insert a worker twice in
the same list (unlikely but possible), and that worker later
disconnects, we would be left with a len mismatch and crash on
a segfault when attempting to access the now-empty worker slot.

Reported-by: Max Sikström <msikstrom@op5.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>
base/workers: Fortify job-to-worker assignments

Previously, we could end up doing one of two unpleasant things when
assigning worker to a job and we had no general-purpose workers left
alive.

If we had special-purpose workers, we would end up leaking memory
when asked to run a job that wasn't connected to us.

If we didn't have special purpose workers, we would end up crashing
when asked to run any job at all.

Both scenarios required, as stated above, that all general-purpose
workers had died.

The memory leak was reported by Max Sikström <msikstrom@op5.com>
during code review. Many thanks.

Signed-off-by: Max Sikström <msikstrom@op5.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>