It was not necessary anymore to allocate memory in str2net(). Moreover, some calls to free() were missing in case of errors.