Skip to contentSkip to conversation

common: fix incorrect comparison

PATCH New Maks Mishin 1 participant 1 message Jan 27, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: fix incorrect comparison

The variable n, which is of type size_t and cannot have negative values, is checked for a negative value in dlmalloc.c:2107.

---
 common/dlmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/dlmalloc.c +1 -1
index cc4d3a0a02..a4182a8dd6 100644
@@ -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;
Signature · 1 line
2.34.1