console-server: Don't require a configuration file
Not requiring a configuration file makes it marginally less irritating
to test obmc-console-server.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ibdf898933284bb4028861d25640bea3c58fb05bf
diff --git a/config.c b/config.c
index 5a2f4f0..707c024 100644
--- a/config.c
+++ b/config.c
@@ -47,6 +47,10 @@
{
struct config_item *item;
+ if (!config) {
+ return NULL;
+ }
+
for (item = config->items; item; item = item->next) {
if (!strcasecmp(item->name, name)) {
return item->value;
@@ -168,6 +172,10 @@
struct config_item *item;
struct config_item *next;
+ if (!config) {
+ return;
+ }
+
for (item = config->items; item; item = next) {
next = item->next;
free(item->name);