diff options
-rw-r--r-- | lib/libssl/src/ssl/d1_pkt.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/lib/libssl/src/ssl/d1_pkt.c b/lib/libssl/src/ssl/d1_pkt.c index 0273db236c5..4e306829bc9 100644 --- a/lib/libssl/src/ssl/d1_pkt.c +++ b/lib/libssl/src/ssl/d1_pkt.c @@ -224,15 +224,8 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) rdata = malloc(sizeof(DTLS1_RECORD_DATA)); item = pitem_new(priority, rdata); - if (rdata == NULL || item == NULL) { - if (rdata != NULL) - free(rdata); - if (item != NULL) - pitem_free(item); - - SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); - return (0); - } + if (rdata == NULL || item == NULL) + goto err; rdata->packet = s->packet; rdata->packet_length = s->packet_length; @@ -254,21 +247,20 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) memset(&(s->s3->rbuf), 0, sizeof(SSL3_BUFFER)); memset(&(s->s3->rrec), 0, sizeof(SSL3_RECORD)); - if (!ssl3_setup_buffers(s)) { - SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); - free(rdata); - pitem_free(item); - return (0); - } + if (!ssl3_setup_buffers(s)) + goto err; /* insert should not fail, since duplicates are dropped */ - if (pqueue_insert(queue->q, item) == NULL) { - free(rdata); - pitem_free(item); - return (0); - } + if (pqueue_insert(queue->q, item) == NULL) + goto err; return (1); + +err: + SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); + free(rdata); + pitem_free(item); + return (0); } |