From: Jonathan McDowell Date: Tue, 7 Jun 2016 15:28:06 +0000 (+0100) Subject: Error out when trying to load a dynamic backend with no configuration X-Git-Tag: onak-0.5.0~26 X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=cc4711251f673ac142f360cfd2a259879b851309;p=onak.git 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. --- 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) {