mirror of
https://github.com/monero-project/monero.git
synced 2024-10-29 20:47:36 +00:00
Merge pull request #8572
50b7492
unit_tests: suppress memwipe unit warning (Jeffrey Ryan)
This commit is contained in:
commit
12489c69cb
1 changed files with 4 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <stdint.h>
|
||||
#include "misc_log_ex.h"
|
||||
#include "memwipe.h"
|
||||
#include "warnings.h"
|
||||
|
||||
// Probably won't catch the optimized out case, but at least we test
|
||||
// it works in the normal case
|
||||
|
@ -44,12 +45,15 @@ static void test(bool wipe)
|
|||
ASSERT_EQ(foo, bar);
|
||||
free(foo);
|
||||
char *quux = (char*)malloc(4); // same size, just after free, so we're likely to get the same, depending on the allocator
|
||||
PUSH_WARNINGS
|
||||
DISABLE_GCC_WARNING(maybe-uninitialized)
|
||||
if ((intptr_t)quux == foop)
|
||||
{
|
||||
MDEBUG(std::hex << std::setw(8) << std::setfill('0') << *(uint32_t*)quux);
|
||||
if (wipe) { ASSERT_TRUE(memcmp(quux, "bar", 3)); }
|
||||
}
|
||||
else MWARNING("We did not get the same location, cannot check");
|
||||
POP_WARNINGS
|
||||
free(quux);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue