[MINOR] fixed useless memory allocation in str2net()

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