Skip to content

Commit

Permalink
Fix ndpi_tot_allocated_memory calculation if ndpi_calloc() used (#…
Browse files Browse the repository at this point in the history
…2604)

Signed-off-by: Toni Uhlig <[email protected]>
  • Loading branch information
utoni authored Oct 21, 2024
1 parent ddbdae9 commit 7fcf54d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/ndpi_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7fcf54d

Please sign in to comment.