Skip to content
Snippets Groups Projects
Commit 24a7e517 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Only copy the buffer size, memuse_log_count can exceed this, also make the log...

Only copy the buffer size, memuse_log_count can exceed this, also make the log pointer volatile to stop potential reordering
parent 91877516
No related branches found
No related tags found
No related merge requests found
......@@ -73,7 +73,7 @@ struct memuse_log_entry {
};
/* The log of allocations and frees. */
static struct memuse_log_entry *memuse_log = NULL;
static struct memuse_log_entry *volatile memuse_log = NULL;
static volatile size_t memuse_log_size = 0;
static volatile size_t memuse_log_count = 0;
static volatile size_t memuse_log_done = 0;
......@@ -103,7 +103,7 @@ static void memuse_log_reallocate(size_t ind) {
/* Copy to new buffer. */
memcpy(new_log, memuse_log,
sizeof(struct memuse_log_entry) * memuse_log_count);
sizeof(struct memuse_log_entry) * memuse_log_size);
free(memuse_log);
memuse_log = new_log;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment