aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-clipboard.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-24 17:46:19 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-24 17:46:19 +0200
commit61ea69d79ca0ad510934a56184fa24ee5621bda3 (patch)
tree6ce038dc2584a0cdc3d107aa32e9ca13bb0985a5 /src/mds-clipboard.c
parenthash-list: style (diff)
downloadmds-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.c10
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));
}