]> the.earth.li Git - onak.git/commitdiff
Error out when trying to load a dynamic backend with no configuration
authorJonathan McDowell <noodles@earth.li>
Tue, 7 Jun 2016 15:28:06 +0000 (16:28 +0100)
committerJonathan McDowell <noodles@earth.li>
Tue, 7 Jun 2016 15:28:06 +0000 (16:28 +0100)
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

index 040a045f67cf388038cbad5c4a4c574e836a7016..5bc539ce25c0ee539b04d1ec1d0264c7eb80e966 100644 (file)
@@ -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) {