[haiku-commits] haiku: hrev44237 - src/preferences/time

  • From: stpere@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 10 Jun 2012 22:58:59 +0200 (CEST)

hrev44237 adds 1 changeset to branch 'master'
old head: 9609fb5050b23018d4d809f2f37ffcb6cbe04860
new head: 163cd4bf53064ff57a1feadc14f04d7c09fc8efc

----------------------------------------------------------------------------

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

                                [ Philippe Saint-Pierre <stpere@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44237
Commit:      163cd4bf53064ff57a1feadc14f04d7c09fc8efc
URL:         http://cgit.haiku-os.org/haiku/commit/?id=163cd4b
Author:      Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date:        Sun Jun 10 20:57:45 2012 UTC

----------------------------------------------------------------------------

1 file changed, 2 insertions(+)
src/preferences/time/ntp.cpp |    2 ++

----------------------------------------------------------------------------

diff --git a/src/preferences/time/ntp.cpp b/src/preferences/time/ntp.cpp
index 7ee56be..167ef2c 100644
--- a/src/preferences/time/ntp.cpp
+++ b/src/preferences/time/ntp.cpp
@@ -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;
        }
 


Other related posts:

  • » [haiku-commits] haiku: hrev44237 - src/preferences/time - stpere