Check return values of pthread_mutex_init and friends

Issue:		#38
Reported by:	Markus Elfring
Handle strdup() failure in early stages of main()

Issue:		#38
Reported by:	Markus Elfring