mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
kwin: fix crash in case of getaddrinfo() failure in client machine test
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
56f58144c7
commit
9b9a39951c
1 changed files with 5 additions and 2 deletions
|
@ -75,7 +75,7 @@ void TestClientMachine::initTestCase()
|
||||||
hostnamebuf[sizeof(hostnamebuf)-1] = 0;
|
hostnamebuf[sizeof(hostnamebuf)-1] = 0;
|
||||||
m_hostName = hostnamebuf;
|
m_hostName = hostnamebuf;
|
||||||
}
|
}
|
||||||
addrinfo *res;
|
addrinfo *res = NULL;
|
||||||
addrinfo addressHints;
|
addrinfo addressHints;
|
||||||
memset(&addressHints, 0, sizeof(addressHints));
|
memset(&addressHints, 0, sizeof(addressHints));
|
||||||
addressHints.ai_family = PF_UNSPEC;
|
addressHints.ai_family = PF_UNSPEC;
|
||||||
|
@ -86,7 +86,9 @@ void TestClientMachine::initTestCase()
|
||||||
m_fqdn = QByteArray(res->ai_canonname);
|
m_fqdn = QByteArray(res->ai_canonname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeaddrinfo(res);
|
if (res) {
|
||||||
|
freeaddrinfo(res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestClientMachine::cleanupTestCase()
|
void TestClientMachine::cleanupTestCase()
|
||||||
|
@ -148,4 +150,5 @@ void TestClientMachine::emptyHostName()
|
||||||
}
|
}
|
||||||
|
|
||||||
KWIN_TEST_MAIN(TestClientMachine)
|
KWIN_TEST_MAIN(TestClientMachine)
|
||||||
|
|
||||||
#include "test_client_machine.moc"
|
#include "test_client_machine.moc"
|
||||||
|
|
Loading…
Add table
Reference in a new issue