]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC UINT_SET: Fix null dereference (coverity)
authorHugo Landau <hlandau@openssl.org>
Thu, 27 Jul 2023 15:24:34 +0000 (16:24 +0100)
committerHugo Landau <hlandau@openssl.org>
Thu, 10 Aug 2023 17:19:51 +0000 (18:19 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21565)

ssl/quic/uint_set.c

index 3bcfdcafd0553edfc4909c26cfc6d81766703abc..3649e7eec2434ddbf3246350d5c1a4ac9b11f425 100644 (file)
@@ -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)