fork.c: fix NULL pointer dereference when nr_threads == threads-max