Skip to content

Commit c6c098d

Browse files
authored
Merge pull request #337 from igchor/fix_memcheck
Fix memcheck errors
2 parents f633a24 + 1542ae0 commit c6c098d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/base_alloc/base_alloc_global.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void *get_original_alloc(void *user_ptr, size_t *total_size,
125125
size_t *metadata_loc = (size_t *)((char *)user_ptr - ALLOC_METADATA_SIZE);
126126

127127
// mark the metadata as defined to read the size and offset
128-
utils_annotate_memory_undefined(metadata_loc, ALLOC_METADATA_SIZE);
128+
utils_annotate_memory_defined(metadata_loc, ALLOC_METADATA_SIZE);
129129

130130
size_t stored_size = *metadata_loc & ((1ULL << 32) - 1);
131131
size_t ptr_offset_from_original = *metadata_loc >> 32;

src/critnib/critnib.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <errno.h>
5757
#include <stdbool.h>
5858
#include <stddef.h>
59+
#include <string.h>
5960

6061
#include "base_alloc.h"
6162
#include "base_alloc_global.h"
@@ -187,6 +188,8 @@ struct critnib *critnib_new(void) {
187188
return NULL;
188189
}
189190

191+
memset(c, 0, sizeof(struct critnib));
192+
190193
void *mutex_ptr = util_mutex_init(&c->mutex);
191194
if (!mutex_ptr) {
192195
goto err_free_critnib;

test/supp/umf_test-jemalloc_pool.supp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
Memcheck:Addr8
44
fun:memmove
55
...
6-
fun:do_rallocx
7-
fun:je_realloc
6+
fun:op_realloc
87
}

0 commit comments

Comments
 (0)