diff options
author | Mark Wielaard <[email protected]> | 2020-10-29 16:43:14 +0100 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2020-10-31 00:49:42 +0100 |
commit | 70717f8c1fdef3ba5e83508bd3956b2479536534 (patch) | |
tree | 3cae2adf11d80ec118b1cba194c7fcbb0119a860 /libasm | |
parent | b256093ad9a8b4972ae02bece266adad8a3c6dbd (diff) |
tests: Run valgrind also on binary tests.
When configuring with --enable-valgrind we were only running valgrind
on tests with a shell wrapper script. This patch makes sure to also run
valgrind on "pure" binary tests. This found one small issue in libasm
where we could be writing some uninitialized padding to an ELF file.
And there were a couple tests that didn't clean up all the resources
they used. Both issues are also fixed with this patch.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libasm')
-rw-r--r-- | libasm/ChangeLog | 5 | ||||
-rw-r--r-- | libasm/asm_align.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 83a65492..d7ab8c42 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,8 @@ +2020-10-29 Mark Wielaard <[email protected]> + + * asm_align.c (__libasm_ensure_section_space): Use calloc, not + malloc to allocate extra space. + 2020-07-19 Mark Wielaard <[email protected]> * libasmP.h: Include libebl.h after libasm.h. diff --git a/libasm/asm_align.c b/libasm/asm_align.c index e59a070e..c8c671b2 100644 --- a/libasm/asm_align.c +++ b/libasm/asm_align.c @@ -143,7 +143,7 @@ __libasm_ensure_section_space (AsmScn_t *asmscn, size_t len) /* This is the first block. */ size = MAX (2 * len, 960); - asmscn->content = (struct AsmData *) malloc (sizeof (struct AsmData) + asmscn->content = (struct AsmData *) calloc (1, sizeof (struct AsmData) + size); if (asmscn->content == NULL) return -1; @@ -160,7 +160,7 @@ __libasm_ensure_section_space (AsmScn_t *asmscn, size_t len) size = MAX (2 *len, MIN (32768, 2 * asmscn->offset)); - newp = (struct AsmData *) malloc (sizeof (struct AsmData) + size); + newp = (struct AsmData *) calloc (1, sizeof (struct AsmData) + size); if (newp == NULL) return -1; |