Skip to content

Commit 0bfbecb

Browse files
fix basic crashes
1 parent f104935 commit 0bfbecb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/basic/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ struct basic_ctx *basic_init(const char *program, uint32_t pid, const char *file
279279
kfree_null(&numbered);
280280
return c;
281281
}
282-
struct basic_ctx *ctx = kmalloc(sizeof(struct basic_ctx));
282+
struct basic_ctx *ctx = kcalloc(1, sizeof(struct basic_ctx));
283283
if (ctx == NULL) {
284284
*error = "Out of memory";
285285
return NULL;
@@ -294,6 +294,8 @@ struct basic_ctx *basic_init(const char *program, uint32_t pid, const char *file
294294
}
295295
buddy_init(ctx->allocator, 6, 26, 26);
296296
ctx->maps = hashmap_new_with_allocator(varmap_malloc, varmap_realloc, varmap_free, sizeof(basic_map_handle_entry), 0, SEED0, SEED1, int64_hash, int64_compare, elfree_map_handle_entry, ctx->allocator);
297+
ctx->active_restrictions = NULL;
298+
ctx->child_restrictions = NULL;
297299
ctx->debug_status = 0;
298300
ctx->match_ctx = NULL;
299301
ctx->debug_breakpoints = NULL;

0 commit comments

Comments
 (0)