From b4af9f029080c5b54ca35ce0f17f5f6600bc6491 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 10 Aug 2017 17:57:36 +0200 Subject: [PATCH] api: bug fixes --- lib/api.c | 3 ++- lib/api/actions/restart.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/api.c b/lib/api.c index a8bdc6504..ebca6d24a 100644 --- a/lib/api.c +++ b/lib/api.c @@ -154,7 +154,8 @@ int api_http_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void if (ret) return -1; - list_remove(&w->api->sessions, s); + if (w->api->sessions.state == STATE_INITIALIZED) + list_remove(&w->api->sessions, s); break; diff --git a/lib/api/actions/restart.c b/lib/api/actions/restart.c index 02431e16d..b9473a950 100644 --- a/lib/api/actions/restart.c +++ b/lib/api/actions/restart.c @@ -45,7 +45,8 @@ static int api_restart(struct api_action *h, json_t *args, json_t **resp, struct json_error_t err; /* If no config is provided via request, we will use the previous one */ - config = strdup(s->api->super_node->uri); + if (s->api->super_node->uri) + config = strdup(s->api->super_node->uri); if (args) { ret = json_unpack_ex(args, &err, 0, "{ s?: s }", "config", &config);