From cc4711251f673ac142f360cfd2a259879b851309 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Tue, 7 Jun 2016 16:28:06 +0100 Subject: [PATCH] Error out when trying to load a dynamic backend with no configuration If we don't have a valid onak_db_config when trying to load a backend in keydb_dynamic, error out right at the start. --- keydb_dynamic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/keydb_dynamic.c b/keydb_dynamic.c index 040a045..5bc539c 100644 --- a/keydb_dynamic.c +++ b/keydb_dynamic.c @@ -215,6 +215,12 @@ struct onak_dbctx *keydb_dynamic_init(struct onak_db_config *dbcfg, struct onak_dbctx *(*backend_init)(struct onak_db_config *, bool); struct onak_dynamic_dbctx *privctx; + if (dbcfg == NULL) { + logthing(LOGTHING_CRITICAL, + "No backend database configuration supplied."); + return NULL; + } + dbctx = malloc(sizeof(struct onak_dbctx)); if (dbctx == NULL) { -- 2.39.5