diff --git a/device_mapper/ioctl/libdm-iface.c b/device_mapper/ioctl/libdm-iface.c index 1321dc008..eb6e9dbf3 100644 --- a/device_mapper/ioctl/libdm-iface.c +++ b/device_mapper/ioctl/libdm-iface.c @@ -471,6 +471,7 @@ static void _dm_zfree_string(char *string) { if (string) { memset(string, 0, strlen(string)); + asm volatile ("" ::: "memory"); /* Compiler barrier. */ free(string); } } @@ -479,6 +480,7 @@ static void _dm_zfree_dmi(struct dm_ioctl *dmi) { if (dmi) { memset(dmi, 0, dmi->data_size); + asm volatile ("" ::: "memory"); /* Compiler barrier. */ free(dmi); } } diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index 002669e8d..b195c115f 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -469,6 +469,7 @@ static void _dm_zfree_string(char *string) { if (string) { memset(string, 0, strlen(string)); + asm volatile ("" ::: "memory"); /* Compiler barrier. */ dm_free(string); } } @@ -477,6 +478,7 @@ static void _dm_zfree_dmi(struct dm_ioctl *dmi) { if (dmi) { memset(dmi, 0, dmi->data_size); + asm volatile ("" ::: "memory"); /* Compiler barrier. */ dm_free(dmi); } }