diff options
| author | miod <> | 2014-07-10 21:57:40 +0000 |
|---|---|---|
| committer | miod <> | 2014-07-10 21:57:40 +0000 |
| commit | 0aea9ca68831e7d47c684686b3e1efcc533bcfd4 (patch) | |
| tree | b3bf760955fe99d2f97e8c9c8c14de047b5eed2c /src/lib/libssl/src | |
| parent | b862c3f44492bec0dd56630e682885b8a44e9e5f (diff) | |
| download | openbsd-0aea9ca68831e7d47c684686b3e1efcc533bcfd4.tar.gz openbsd-0aea9ca68831e7d47c684686b3e1efcc533bcfd4.tar.bz2 openbsd-0aea9ca68831e7d47c684686b3e1efcc533bcfd4.zip | |
Simplify realloc() usage; ok tedu@
Diffstat (limited to 'src/lib/libssl/src')
| -rw-r--r-- | src/lib/libssl/src/crypto/bio/b_sock.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c index 32ac3b0664..bbae2a31b9 100644 --- a/src/lib/libssl/src/crypto/bio/b_sock.c +++ b/src/lib/libssl/src/crypto/bio/b_sock.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: b_sock.c,v 1.52 2014/07/10 13:58:22 jsing Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.53 2014/07/10 21:57:40 miod Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -417,26 +417,17 @@ BIO_accept(int sock, char **addr) | |||
| 417 | break; | 417 | break; |
| 418 | nl = strlen(h) + strlen(s) + 2; | 418 | nl = strlen(h) + strlen(s) + 2; |
| 419 | p = *addr; | 419 | p = *addr; |
| 420 | if (p) { | 420 | if (p) |
| 421 | *p = '\0'; | 421 | *p = '\0'; |
| 422 | if (!(tmp = realloc(p, nl))) { | 422 | if (!(tmp = realloc(p, nl))) { |
| 423 | close(ret); | ||
| 424 | ret = -1; | ||
| 425 | free(p); | ||
| 426 | *addr = NULL; | ||
| 427 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | ||
| 428 | goto end; | ||
| 429 | } | ||
| 430 | p = tmp; | ||
| 431 | } else { | ||
| 432 | p = malloc(nl); | ||
| 433 | } | ||
| 434 | if (p == NULL) { | ||
| 435 | close(ret); | 423 | close(ret); |
| 436 | ret = -1; | 424 | ret = -1; |
| 425 | free(p); | ||
| 426 | *addr = NULL; | ||
| 437 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | 427 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); |
| 438 | goto end; | 428 | goto end; |
| 439 | } | 429 | } |
| 430 | p = tmp; | ||
| 440 | *addr = p; | 431 | *addr = p; |
| 441 | snprintf(*addr, nl, "%s:%s", h, s); | 432 | snprintf(*addr, nl, "%s:%s", h, s); |
| 442 | goto end; | 433 | goto end; |
