(krb5_change_password): remember to close the socket on error

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8215 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-05-12 15:26:57 +00:00
parent c46407cd43
commit dc17bca7aa

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska H<>gskolan * Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -289,8 +289,10 @@ krb5_change_password (krb5_context context,
a->ai_addr, a->ai_addr,
a->ai_addrlen, a->ai_addrlen,
newpw); newpw);
if (ret) if (ret) {
close(sock);
goto out; goto out;
}
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sock, &fdset); FD_SET(sock, &fdset);
@@ -298,8 +300,10 @@ krb5_change_password (krb5_context context,
tv.tv_sec = 1 << i; tv.tv_sec = 1 << i;
ret = select (sock + 1, &fdset, NULL, NULL, &tv); ret = select (sock + 1, &fdset, NULL, NULL, &tv);
if (ret < 0 && errno != EINTR) if (ret < 0 && errno != EINTR) {
close(sock);
goto out; goto out;
}
if (ret == 1) if (ret == 1)
break; break;
} }