From 43321064287cca6af7c15f173bbcefc351960cc0 Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Thu, 26 Nov 2020 19:49:59 +0000 Subject: posix runtime: add malloc checks --- runtime/POSIX/klee_init_env.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'runtime/POSIX/klee_init_env.c') diff --git a/runtime/POSIX/klee_init_env.c b/runtime/POSIX/klee_init_env.c index f45ddf3c..aaee4c4e 100644 --- a/runtime/POSIX/klee_init_env.c +++ b/runtime/POSIX/klee_init_env.c @@ -16,9 +16,6 @@ #include #include #include -#include -#include -#include static void __emit_error(const char *msg) { klee_report_error(__FILE__, __LINE__, msg, "user.err"); @@ -62,12 +59,14 @@ static int __streq(const char *a, const char *b) { static char *__get_sym_str(int numChars, char *name) { int i; char *s = malloc(numChars+1); + if (!s) + __emit_error("out of memory in klee_init_env"); klee_mark_global(s); klee_make_symbolic(s, numChars+1, name); for (i=0; i