summaryrefslogtreecommitdiffstats
path: root/ssl/quic/uint_set.c
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-07-27 16:24:34 +0100
committerHugo Landau <hlandau@openssl.org>2023-08-10 18:19:51 +0100
commit8761efb2ccc96f81201af279ec66e8ceeee9c7a3 (patch)
tree3c70bb85ddfe09baebe8b36116a38a579d78c6a7 /ssl/quic/uint_set.c
parentf540b6b4f6608fa5edfa2ec77fce6d3c92bb9a1f (diff)
QUIC UINT_SET: Fix null dereference (coverity)
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21565)
Diffstat (limited to 'ssl/quic/uint_set.c')
-rw-r--r--ssl/quic/uint_set.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ssl/quic/uint_set.c b/ssl/quic/uint_set.c
index 3bcfdcafd0..3649e7eec2 100644
--- a/ssl/quic/uint_set.c
+++ b/ssl/quic/uint_set.c
@@ -111,14 +111,15 @@ static int uint_range_overlaps(const UINT_RANGE *a,
static UINT_SET_ITEM *create_set_item(uint64_t start, uint64_t end)
{
- UINT_SET_ITEM *x = OPENSSL_malloc(sizeof(UINT_SET_ITEM));
+ UINT_SET_ITEM *x = OPENSSL_malloc(sizeof(UINT_SET_ITEM));
- ossl_list_uint_set_init_elem(x);
- if (x != NULL) {
- x->range.start = start;
- x->range.end = end;
- }
- return x;
+ if (x == NULL)
+ return NULL;
+
+ ossl_list_uint_set_init_elem(x);
+ x->range.start = start;
+ x->range.end = end;
+ return x;
}
int ossl_uint_set_insert(UINT_SET *s, const UINT_RANGE *range)