[PATCH] common: fix incorrect comparison

27 Jan
2025
27 Jan
'25
5:03 p.m.
The variable n, which is of type size_t and cannot have negative values, is checked for a negative value in dlmalloc.c:2107.
Signed-off-by: Maks Mishin maks.mishinFZ@gmail.com --- common/dlmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index cc4d3a0a02..a4182a8dd6 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -2104,7 +2104,7 @@ Void_t* cALLOc_impl(n, elem_size) size_t n; size_t elem_size; #endif Void_t* mem = mALLOc_impl (sz);
- if ((long)n < 0) return NULL; + if ((long)n <= 0) return NULL;
if (mem == NULL) return NULL;
--
2.34.1
99
Age (days ago)
99
Last active (days ago)
0 comments
1 participants
participants (1)
-
Maks Mishin