aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2024-10-21 16:17:23 +0200
committerGitHub <noreply@github.com>2024-10-21 16:17:23 +0200
commit7fcf54dd8489f77352798e23d0067fe256409b75 (patch)
tree769cd97130c08c1e1cf413a4ef2c84a487338cf1
parentddbdae9947dbde7bd986b70bdf9ffa406f0906f3 (diff)
Fix `ndpi_tot_allocated_memory` calculation if `ndpi_calloc()` used (#2604)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--src/lib/ndpi_memory.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ndpi_memory.c b/src/lib/ndpi_memory.c
index 325806ddc..f9df7acc6 100644
--- a/src/lib/ndpi_memory.c
+++ b/src/lib/ndpi_memory.c
@@ -64,11 +64,11 @@ void *ndpi_malloc(size_t size) {
void *ndpi_calloc(unsigned long count, size_t size) {
size_t len = count * size;
- void *p = ndpi_malloc(len);
+ void *p = _ndpi_malloc ? _ndpi_malloc(len) : malloc(len);
if(p) {
memset(p, 0, len);
- __sync_fetch_and_add(&ndpi_tot_allocated_memory, size);
+ __sync_fetch_and_add(&ndpi_tot_allocated_memory, len);
}
return(p);