From 61ea69d79ca0ad510934a56184fa24ee5621bda3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 24 Aug 2015 17:46:19 +0200 Subject: mds-clipboard: improve wipe_and_free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-clipboard.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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 @@ -203,16 +203,22 @@ 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)); } -- cgit v1.2.3-70-g09d2