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 04052dd commit d1c7714
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ extern vmod_state_t vmod_state;
#define REDIS_FAIL_WS(ctx, result) \
REDIS_FAIL(ctx, result, "Workspace overflow")

#define REDIS_FAIL_INSTANCE(ctx, result) \
REDIS_FAIL(ctx, result, "Failed to create instance")

#ifdef TLS_ENABLED
#define REDIS_TLS(ctx, rcontext, db, message1, message2, ...) \
do { \
Expand Down
4 changes: 4 additions & 0 deletions src/vmod_redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,10 @@ vmod_db__init(
"New database instance registered (db=%s)",
instance->name);
}

if (*db == NULL) {
REDIS_FAIL_WS(ctx,);
}
}

VCL_VOID
Expand Down

0 comments on commit d1c7714

Please sign in to comment.