diff options
| author | logan <> | 2014-06-11 13:19:53 +0000 |
|---|---|---|
| committer | logan <> | 2014-06-11 13:19:53 +0000 |
| commit | 8e5f7d00b9abd5d29222fecd91d302d328a6dbc6 (patch) | |
| tree | 128fccccbd8599c03792ce456bbb15085eba9fe6 | |
| parent | 3cfd4331825dbf02b7beeac7702b6022af4b0587 (diff) | |
| download | openbsd-8e5f7d00b9abd5d29222fecd91d302d328a6dbc6.tar.gz openbsd-8e5f7d00b9abd5d29222fecd91d302d328a6dbc6.tar.bz2 openbsd-8e5f7d00b9abd5d29222fecd91d302d328a6dbc6.zip | |
Fix memory leak: free s if calloc fails.
(From Jonas Maebe)
OK from beck@
| -rw-r--r-- | src/lib/libssl/d1_lib.c | 4 | ||||
| -rw-r--r-- | src/lib/libssl/src/ssl/d1_lib.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c index 4ee3e36168..c417c295df 100644 --- a/src/lib/libssl/d1_lib.c +++ b/src/lib/libssl/d1_lib.c | |||
| @@ -104,8 +104,10 @@ dtls1_new(SSL *s) | |||
| 104 | 104 | ||
| 105 | if (!ssl3_new(s)) | 105 | if (!ssl3_new(s)) |
| 106 | return (0); | 106 | return (0); |
| 107 | if ((d1 = calloc(1, sizeof *d1)) == NULL) | 107 | if ((d1 = calloc(1, sizeof *d1)) == NULL) { |
| 108 | ssl3_free(s); | ||
| 108 | return (0); | 109 | return (0); |
| 110 | } | ||
| 109 | 111 | ||
| 110 | /* d1->handshake_epoch=0; */ | 112 | /* d1->handshake_epoch=0; */ |
| 111 | 113 | ||
diff --git a/src/lib/libssl/src/ssl/d1_lib.c b/src/lib/libssl/src/ssl/d1_lib.c index 4ee3e36168..c417c295df 100644 --- a/src/lib/libssl/src/ssl/d1_lib.c +++ b/src/lib/libssl/src/ssl/d1_lib.c | |||
| @@ -104,8 +104,10 @@ dtls1_new(SSL *s) | |||
| 104 | 104 | ||
| 105 | if (!ssl3_new(s)) | 105 | if (!ssl3_new(s)) |
| 106 | return (0); | 106 | return (0); |
| 107 | if ((d1 = calloc(1, sizeof *d1)) == NULL) | 107 | if ((d1 = calloc(1, sizeof *d1)) == NULL) { |
| 108 | ssl3_free(s); | ||
| 108 | return (0); | 109 | return (0); |
| 110 | } | ||
| 109 | 111 | ||
| 110 | /* d1->handshake_epoch=0; */ | 112 | /* d1->handshake_epoch=0; */ |
| 111 | 113 | ||
