]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
hashtable: Avoid compiler warning with GCC 12
authorTobias Brunner <tobias@strongswan.org>
Thu, 16 Jun 2022 08:23:16 +0000 (10:23 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 27 Jun 2022 12:09:11 +0000 (14:09 +0200)
Even though the assignment of `removed` to `out_row` is tied to the
`found_removed` flag, which is only set if `removed` is set, the
compiler complains that it may be used uninitialized.

src/libstrongswan/collections/hashtable.c

index fa1e4a093799129cc56649a12693a31da6bf65bf..809650a5316c7ac3ec48cf65553a90c3e2dc1c3b 100644 (file)
@@ -289,7 +289,7 @@ static inline pair_t *find_key(private_hashtable_t *this, const void *key,
                                                                u_int *out_hash, u_int *out_row)
 {
        pair_t *pair;
-       u_int hash, row, p = 0, removed, index;
+       u_int hash, row, p = 0, removed = 0, index;
        bool found_removed = FALSE;
 
        if (!this->count && !out_hash && !out_row)