From fca966385eef20f4e3de0da1a64c12c94f8eeabb Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Wed, 12 Feb 2020 13:28:39 +0100 Subject: [PATCH] coap-server.c: Immediate exit when no endpoints defined get_context() creates a new context object and adds coap_endpoint_t objects for all listen addresses. The function now clears the context object and returns NULL when no endpoint was created, causing the server to exit immediately. --- examples/coap-server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/coap-server.c b/examples/coap-server.c index 55fb9cd7..5a6ab017 100644 --- a/examples/coap-server.c +++ b/examples/coap-server.c @@ -1119,6 +1119,8 @@ get_context(const char *node, const char *port) { } fprintf(stderr, "no context available for interface '%s'\n", node); + coap_free_context(ctx); + ctx = NULL; finish: freeaddrinfo(result);