diff options
author | Yifan Lu | 2016-10-05 23:08:44 -0700 |
---|---|---|
committer | Yifan Lu | 2016-10-05 23:08:44 -0700 |
commit | f1e005d63bfb0245969bad46ff13523ec00dd1c6 (patch) | |
tree | 139b3196dace1557d1cb270deca68c0c156324af /lib/hook-functions.c | |
parent | execmem_alloc_unsealed now outputs a separate pointer for exec and writing to... (diff) | |
download | substitute-f1e005d63bfb0245969bad46ff13523ec00dd1c6.tar.gz |
Changed malloc in substitute_hook_functions to alloca
Diffstat (limited to 'lib/hook-functions.c')
-rw-r--r-- | lib/hook-functions.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/hook-functions.c b/lib/hook-functions.c index a39cbb0..d7b925f 100644 --- a/lib/hook-functions.c +++ b/lib/hook-functions.c @@ -5,6 +5,7 @@ #include "transform-dis.h" #include "execmem.h" #include stringify(TARGET_DIR/jump-patch.h) +#include <alloca.h> #ifndef NO_PTHREADS #include <pthread.h> #endif @@ -149,7 +150,7 @@ int substitute_hook_functions(const struct substitute_function_hook *hooks, *recordp = NULL; struct execmem_foreign_write *fws; - struct hook_internal *his = malloc(nhooks * sizeof(*his) + + struct hook_internal *his = alloca(nhooks * sizeof(*his) + nhooks * sizeof(*fws)); if (!his) return SUBSTITUTE_ERR_OOM; @@ -297,7 +298,6 @@ end: execmem_free(page); } end_dont_free: - free(his); return ret; } |