mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 01:42:27 +00:00
memwipe: don't call the workhorse for 0 bytes
Some of them don't like it
This commit is contained in:
parent
eed4dba880
commit
8d578f1f2d
1 changed files with 5 additions and 3 deletions
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
void *memwipe(void *ptr, size_t n)
|
void *memwipe(void *ptr, size_t n)
|
||||||
{
|
{
|
||||||
if (memset_s(ptr, n, 0, n))
|
if (n > 0 && memset_s(ptr, n, 0, n))
|
||||||
{
|
{
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
fprintf(stderr, "Error: memset_s failed\n");
|
fprintf(stderr, "Error: memset_s failed\n");
|
||||||
|
@ -67,6 +67,7 @@ void *memwipe(void *ptr, size_t n)
|
||||||
|
|
||||||
void *memwipe(void *ptr, size_t n)
|
void *memwipe(void *ptr, size_t n)
|
||||||
{
|
{
|
||||||
|
if (n > 0)
|
||||||
explicit_bzero(ptr, n);
|
explicit_bzero(ptr, n);
|
||||||
SCARECROW
|
SCARECROW
|
||||||
return ptr;
|
return ptr;
|
||||||
|
@ -105,6 +106,7 @@ static void memory_cleanse(void *ptr, size_t len)
|
||||||
|
|
||||||
void *memwipe(void *ptr, size_t n)
|
void *memwipe(void *ptr, size_t n)
|
||||||
{
|
{
|
||||||
|
if (n > 0)
|
||||||
memory_cleanse(ptr, n);
|
memory_cleanse(ptr, n);
|
||||||
SCARECROW
|
SCARECROW
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
Loading…
Reference in a new issue