Prevent ressource leak in time preferences (ntp update) CID 702055.

This commit is contained in:
Philippe Saint-Pierre
2012-06-10 16:57:45 -04:00
parent 9609fb5050
commit 163cd4bf53
+2
View File
@@ -153,6 +153,7 @@ ntp_update_time(const char* hostname, const char** errorString,
0, (struct sockaddr *)&address, sizeof(address)) < 0) {
*errorString = B_TRANSLATE("Sending request failed");
*errorCode = errno;
close(connection);
return B_ERROR;
}
@@ -168,6 +169,7 @@ ntp_update_time(const char* hostname, const char** errorString,
if (select(connection + 1, &waitForReceived, NULL, NULL, &timeout) <= 0) {
*errorString = B_TRANSLATE("Waiting for answer failed");
*errorCode = errno;
close(connection);
return B_ERROR;
}