Only free res iff it's been allocated before. Re #1201
This patch fixes the segfault, so closing the ticket might be possible. It's a very conservative patch. Perhaps the freeaddrinfo spec says that it will never allocate res in case of errors, but for now, I neither have the spec nor the will to rely on it. This commit was SVN r17150.
Этот коммит содержится в:
родитель
908b514ac5
Коммит
4b50f02126
@ -938,10 +938,13 @@ int opal_ifaddrtoname(const char* if_addr, char* if_name, int length)
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
res = NULL;
|
||||
error = getaddrinfo(if_addr, NULL, &hints, &res);
|
||||
|
||||
if (error) {
|
||||
freeaddrinfo (res);
|
||||
if (NULL != res) {
|
||||
freeaddrinfo (res);
|
||||
}
|
||||
return OPAL_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user