From cdb10bae3f773401e039c55965eb177a6f3fc160 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 3 Apr 2018 11:31:16 -0400 Subject: Set error code on alloc failures Almost all *alloc failures now set an error code. Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/5842) --- ssl/pqueue.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ssl/pqueue.c') diff --git a/ssl/pqueue.c b/ssl/pqueue.c index ee64eb32ca..3787d260b7 100644 --- a/ssl/pqueue.c +++ b/ssl/pqueue.c @@ -18,14 +18,15 @@ struct pqueue_st { pitem *pitem_new(unsigned char *prio64be, void *data) { pitem *item = OPENSSL_malloc(sizeof(*item)); - if (item == NULL) + + if (item == NULL) { + SSLerr(SSL_F_PITEM_NEW, ERR_R_MALLOC_FAILURE); return NULL; + } memcpy(item->priority, prio64be, sizeof(item->priority)); - item->data = data; item->next = NULL; - return item; } @@ -38,6 +39,9 @@ pqueue *pqueue_new() { pqueue *pq = OPENSSL_zalloc(sizeof(*pq)); + if (pq == NULL) + SSLerr(SSL_F_PQUEUE_NEW, ERR_R_MALLOC_FAILURE); + return pq; } -- cgit v1.2.3