c-template
safe_mem.h
Go to the documentation of this file.
1
#include <stdlib.h>
2
#include <stdbool.h>
3
4
/*
5
memory_object is a wrapper around a void pointer type
6
that pevents double-free vulnerabilities on that void pointer type
7
*/
8
9
typedef
struct
memory_object
{
10
void
*
data
;
11
bool
freed
;
12
}
memory_object
;
13
14
15
// frees the data field of memory_object but does not free memory allocated for the memory_object itself
16
int
free_memory_object_data
(
memory_object
*obj);
17
// returns a new memory_object with data field set to input
18
memory_object
new_memory_object
(
void
*input);
free_memory_object_data
int free_memory_object_data(memory_object *obj)
Definition:
safe_mem.c:11
new_memory_object
memory_object new_memory_object(void *input)
Definition:
safe_mem.c:30
memory_object
Definition:
safe_mem.h:9
memory_object::freed
bool freed
Definition:
safe_mem.h:11
memory_object::data
void * data
Definition:
safe_mem.h:10
memory_object
struct memory_object memory_object
include
utils
safe_mem.h
Generated by
1.8.17