diff --git a/src/helpers.h b/src/helpers.h index d850851..876a353 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -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 diff --git a/src/vmod_cfg_file.c b/src/vmod_cfg_file.c index 5a33ae4..c191e2e 100644 --- a/src/vmod_cfg_file.c +++ b/src/vmod_cfg_file.c @@ -358,6 +358,10 @@ vmod_file__init( } } + if (instance == NULL) { + FAIL_INSTANCE(ctx,); + } + *file = instance; } diff --git a/src/vmod_cfg_rules.c b/src/vmod_cfg_rules.c index 10027d2..383ba51 100644 --- a/src/vmod_cfg_rules.c +++ b/src/vmod_cfg_rules.c @@ -265,6 +265,10 @@ vmod_rules__init( } } + if (instance == NULL) { + FAIL_INSTANCE(ctx,); + } + *rules = instance; } diff --git a/src/vmod_cfg_script.c b/src/vmod_cfg_script.c index fba32ca..5add701 100644 --- a/src/vmod_cfg_script.c +++ b/src/vmod_cfg_script.c @@ -151,6 +151,10 @@ vmod_script__init( } } + if (instance == NULL) { + FAIL_INSTANCE(ctx,); + } + *script = instance; }