I\'m supporting some c code on Solaris, and I\'ve seen something weird at least I think it is:
char new_login[64];
...
strcpy(new_login, (char *)login);
...
No. This is a bug.
According to free(3)....
free() frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is NULL, no operation is performed.
So you have undefined behavior happening in your program.