diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2024-10-21 15:01:25 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2024-10-21 15:18:08 +0200 |
commit | 2388b05064a17778b89a89505c51cfb21f8e5dc5 (patch) | |
tree | 769cd97130c08c1e1cf413a4ef2c84a487338cf1 | |
parent | ddbdae9947dbde7bd986b70bdf9ffa406f0906f3 (diff) |
Fix `ndpi_tot_allocated_memory` calculation if `ndpi_calloc()` usedfix/double-ndpi_tot_allocated_memory-add
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | src/lib/ndpi_memory.c | 4 |
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); |