mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-13 15:00:59 +01:00
BUILD: pool: Fix GCC error about potential null pointer dereference
In pool_gc(), GCC 13.2.1 reports an error about a potential null potential
dereference:
src/pool.c: In function ‘pool_gc’:
src/pool.c:807:64: error: potential null pointer dereference [-Werror=null-dereference]
807 | entry->buckets[bucket].free_list = temp->next;
| ~~~~^~~~~~
There is no issue here because "bucket" variable cannot be greater than
CONFIG_HAP_POOL_BUCKETS. But to make GCC happy, we now break the loop if it
is greater or equal to CONFIG_HAP_POOL_BUCKETS.
This commit is contained in:
parent
90873dc678
commit
b62d5689d2
@ -800,7 +800,7 @@ void pool_gc(struct pool_head *pool_ctx)
|
|||||||
while (!entry->buckets[bucket].free_list && bucket < CONFIG_HAP_POOL_BUCKETS)
|
while (!entry->buckets[bucket].free_list && bucket < CONFIG_HAP_POOL_BUCKETS)
|
||||||
bucket++;
|
bucket++;
|
||||||
|
|
||||||
if (bucket == CONFIG_HAP_POOL_BUCKETS)
|
if (bucket >= CONFIG_HAP_POOL_BUCKETS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
temp = entry->buckets[bucket].free_list;
|
temp = entry->buckets[bucket].free_list;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user