aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifan Lu2016-10-05 23:08:44 -0700
committerYifan Lu2016-10-05 23:08:44 -0700
commitf1e005d63bfb0245969bad46ff13523ec00dd1c6 (patch)
tree139b3196dace1557d1cb270deca68c0c156324af
parentexecmem_alloc_unsealed now outputs a separate pointer for exec and writing to... (diff)
downloadsubstitute-f1e005d63bfb0245969bad46ff13523ec00dd1c6.tar.gz
Changed malloc in substitute_hook_functions to alloca
-rw-r--r--lib/hook-functions.c4
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;
}