diff options
| author | tedu <> | 2014-04-23 20:22:37 +0000 |
|---|---|---|
| committer | tedu <> | 2014-04-23 20:22:37 +0000 |
| commit | f6354db5c683bc6818a3ae0a37cb7f0df09623c9 (patch) | |
| tree | 9de05a0adecef048e075b6a22c4b6b0361143a6d | |
| parent | 96c50cef9d7eaef43992f73f025bdca040890c42 (diff) | |
| download | openbsd-f6354db5c683bc6818a3ae0a37cb7f0df09623c9.tar.gz openbsd-f6354db5c683bc6818a3ae0a37cb7f0df09623c9.tar.bz2 openbsd-f6354db5c683bc6818a3ae0a37cb7f0df09623c9.zip | |
close socket in failure cases too
| -rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 3 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/bio/b_sock.c | 3 |
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; |
