mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-18 14:10:31 -04:00
tests: make no-optimize attribute Clang compatible
This commit is contained in:
parent
b404d6da6e
commit
de3fb50dcc
34 changed files with 113 additions and 67 deletions
|
@ -1,16 +1,18 @@
|
|||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
__attribute__((optimize(0)))
|
||||
void leak_memory(void) {
|
||||
#include "test_util.h"
|
||||
|
||||
OPTNONE static void leak_memory(void) {
|
||||
(void)malloc(1024 * 1024 * 1024);
|
||||
(void)malloc(16);
|
||||
(void)malloc(32);
|
||||
(void)malloc(4096);
|
||||
}
|
||||
|
||||
void *do_work(void *p) {
|
||||
static void *do_work(void *p) {
|
||||
leak_memory();
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue