>> + goto cleanup;
>> + }
>> +
>> + iothrid->thread_id = new_iothreads[idx]->thread_id;
You are also not marking the thread structure as 'defined' and thus
wouldn't format it later ...
Changed to 'undefined' now, so this is unnecessary
(although perhaps 'autofill' is a better term....
John