Use same alloc function in subsearch

Just tune it for special case where file and line are added
at the same time
Exit threads in atexit to simplify the return case