Skip to content

Commit c721997

Browse files
committed
fix all the asan stuff I can find
1 parent e97f49a commit c721997

File tree

6 files changed

+11
-4
lines changed

6 files changed

+11
-4
lines changed

src/driver/driver.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ ShadyErrorCodes driver_load_source_files(DriverConfig* args, Module* mod) {
104104
if (err)
105105
return err;
106106
link_module(mod, m);
107+
destroy_ir_arena(get_module_arena(m));
107108
}
108109

109110
return NoError;

src/driver/vcc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ int main(int argc, char** argv) {
152152
remove(vcc_options.tmp_filename);
153153

154154
driver_compile(&args, mod);
155+
destroy_ir_arena(get_module_arena(mod));
155156
}
156157

157158
info_print("Done\n");

src/shady/analysis/free_variables.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,5 @@ void destroy_scope_variables_map(struct Dict* map) {
157157
destroy_dict(value->free_set);
158158
free((void*) value);
159159
}
160+
destroy_dict(map);
160161
}

src/shady/compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void add_scheduler_source(const CompilerConfig* config, Module* dst) {
8484
Module* builtin_scheduler_mod = parse_slim_module(config, pconfig, shady_scheduler_src, "builtin_scheduler");
8585
debug_print("Adding builtin scheduler code");
8686
link_module(dst, builtin_scheduler_mod);
87+
destroy_ir_arena(get_module_arena(builtin_scheduler_mod));
8788
}
8889

8990
CompilationResult run_compiler_passes(CompilerConfig* config, Module** pmod) {

src/shady/passes/reconvergence_heuristics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,10 @@ static const Node* process_node(Context* ctx, const Node* node) {
378378
Rewriter* rewriter = &ctx->rewriter;
379379
IrArena* arena = rewriter->dst_arena;
380380

381+
Context new_context = *ctx;
382+
381383
switch (node->tag) {
382384
case Function_TAG: {
383-
Context new_context = *ctx;
384385
ctx = &new_context;
385386
ctx->current_fn = node;
386387
ctx->fwd_scope = new_scope(ctx->current_fn);
@@ -397,7 +398,6 @@ static const Node* process_node(Context* ctx, const Node* node) {
397398
return new;
398399
}
399400
case Constant_TAG: {
400-
Context new_context = *ctx;
401401
ctx = &new_context;
402402
ctx->current_fn = NULL;
403403
rewriter = &ctx->rewriter;

src/shady/print.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,11 @@ void log_module(LogLevel level, const CompilerConfig* compiler_cfg, Module* mod)
10331033
config.print_builtin = compiler_cfg->logging.print_builtin;
10341034
config.print_internal = compiler_cfg->logging.print_internal;
10351035
}
1036-
if (level >= get_log_level())
1037-
print_module(open_file_as_printer(stderr), mod, config);
1036+
if (level >= get_log_level()) {
1037+
Printer* p = open_file_as_printer(stderr);
1038+
print_module(p, mod, config);
1039+
destroy_printer(p);
1040+
}
10381041
}
10391042

10401043
void print_node_operand(Printer* p, const Node* n, String name, NodeClass op_class, const Node* op, PrintConfig config) {

0 commit comments

Comments
 (0)