diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-24 17:46:19 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-24 17:46:19 +0200 |
commit | 61ea69d79ca0ad510934a56184fa24ee5621bda3 (patch) | |
tree | 6ce038dc2584a0cdc3d107aa32e9ca13bb0985a5 /src | |
parent | hash-list: style (diff) | |
download | mds-61ea69d79ca0ad510934a56184fa24ee5621bda3.tar.gz mds-61ea69d79ca0ad510934a56184fa24ee5621bda3.tar.bz2 mds-61ea69d79ca0ad510934a56184fa24ee5621bda3.tar.xz |
mds-clipboard: improve wipe_and_free
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-clipboard.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mds-clipboard.c b/src/mds-clipboard.c index 52f40f0..02918ae 100644 --- a/src/mds-clipboard.c +++ b/src/mds-clipboard.c @@ -204,15 +204,21 @@ size_t marshal_server_size(void) /** + * `memset`, but the compiler does not know that + */ +void* (* volatile mds_clipboard_my_explicit_memset)(void* s, int c, size_t n) = memset; + + +/** * Wipe a memory area and free it * * @param s The memory area * @param n The number of bytes to write */ -static inline __attribute__((optimize("-O0"))) void wipe_and_free(void* s, size_t n) +static inline void wipe_and_free(void* s, size_t n) { if (s != NULL) - free(memset(s, 0, n)); /* TODO use explicit_bzero-like wipe */ + free(mds_clipboard_my_explicit_memset(s, 0, n)); } |