Skip to content

Commit

Permalink
Abort 'vcl_init' asap if a VMOD object instance cannot be created. See
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosabalde committed Sep 17, 2024
1 parent 65b7c88 commit 6348719
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ extern vmod_state_t vmod_state;
#define FAIL_WS(ctx, result) \
FAIL(ctx, result, "Workspace overflow")

#define FAIL_INSTANCE(ctx, result) \
FAIL(ctx, result, "Failed to create instance")

#endif
4 changes: 4 additions & 0 deletions src/vmod_cfg_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ vmod_file__init(
}
}

if (instance == NULL) {
FAIL_INSTANCE(ctx,);
}

*file = instance;
}

Expand Down
4 changes: 4 additions & 0 deletions src/vmod_cfg_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ vmod_rules__init(
}
}

if (instance == NULL) {
FAIL_INSTANCE(ctx,);
}

*rules = instance;
}

Expand Down
4 changes: 4 additions & 0 deletions src/vmod_cfg_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ vmod_script__init(
}
}

if (instance == NULL) {
FAIL_INSTANCE(ctx,);
}

*script = instance;
}

Expand Down

0 comments on commit 6348719

Please sign in to comment.