summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortedu <>2014-04-23 20:22:37 +0000
committertedu <>2014-04-23 20:22:37 +0000
commitf1b7004c7ee0d3ac1478798a5bb85e83483abe6f (patch)
tree9de05a0adecef048e075b6a22c4b6b0361143a6d /src/lib
parente3592fe2c0916765b0df5ec949819542f3898a70 (diff)
downloadopenbsd-f1b7004c7ee0d3ac1478798a5bb85e83483abe6f.tar.gz
openbsd-f1b7004c7ee0d3ac1478798a5bb85e83483abe6f.tar.bz2
openbsd-f1b7004c7ee0d3ac1478798a5bb85e83483abe6f.zip
close socket in failure cases too
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/bio/b_sock.c3
-rw-r--r--src/lib/libssl/src/crypto/bio/b_sock.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c
index a7791b39e2..e5f42398df 100644
--- a/src/lib/libcrypto/bio/b_sock.c
+++ b/src/lib/libcrypto/bio/b_sock.c
@@ -535,6 +535,7 @@ BIO_accept(int sock, char **addr)
535 if (p) { 535 if (p) {
536 *p = '\0'; 536 *p = '\0';
537 if (!(tmp = realloc(p, nl))) { 537 if (!(tmp = realloc(p, nl))) {
538 close(ret);
538 ret = -1; 539 ret = -1;
539 free(p); 540 free(p);
540 *addr = NULL; 541 *addr = NULL;
@@ -546,6 +547,7 @@ BIO_accept(int sock, char **addr)
546 p = malloc(nl); 547 p = malloc(nl);
547 } 548 }
548 if (p == NULL) { 549 if (p == NULL) {
550 close(ret);
549 ret = -1; 551 ret = -1;
550 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); 552 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
551 goto end; 553 goto end;
@@ -561,6 +563,7 @@ BIO_accept(int sock, char **addr)
561 port = ntohs(sa.from.sa_in.sin_port); 563 port = ntohs(sa.from.sa_in.sin_port);
562 if (*addr == NULL) { 564 if (*addr == NULL) {
563 if ((p = malloc(24)) == NULL) { 565 if ((p = malloc(24)) == NULL) {
566 close(ret);
564 ret = -1; 567 ret = -1;
565 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); 568 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
566 goto end; 569 goto end;
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c
index a7791b39e2..e5f42398df 100644
--- a/src/lib/libssl/src/crypto/bio/b_sock.c
+++ b/src/lib/libssl/src/crypto/bio/b_sock.c
@@ -535,6 +535,7 @@ BIO_accept(int sock, char **addr)
535 if (p) { 535 if (p) {
536 *p = '\0'; 536 *p = '\0';
537 if (!(tmp = realloc(p, nl))) { 537 if (!(tmp = realloc(p, nl))) {
538 close(ret);
538 ret = -1; 539 ret = -1;
539 free(p); 540 free(p);
540 *addr = NULL; 541 *addr = NULL;
@@ -546,6 +547,7 @@ BIO_accept(int sock, char **addr)
546 p = malloc(nl); 547 p = malloc(nl);
547 } 548 }
548 if (p == NULL) { 549 if (p == NULL) {
550 close(ret);
549 ret = -1; 551 ret = -1;
550 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); 552 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
551 goto end; 553 goto end;
@@ -561,6 +563,7 @@ BIO_accept(int sock, char **addr)
561 port = ntohs(sa.from.sa_in.sin_port); 563 port = ntohs(sa.from.sa_in.sin_port);
562 if (*addr == NULL) { 564 if (*addr == NULL) {
563 if ((p = malloc(24)) == NULL) { 565 if ((p = malloc(24)) == NULL) {
566 close(ret);
564 ret = -1; 567 ret = -1;
565 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); 568 BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
566 goto end; 569 goto end;