From edca08249b8ef180727dc63f549758feb83d69f5 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Fri, 3 Nov 2017 14:18:19 +0100 Subject: [PATCH] coap-server.c: fixed memory leak in get_context() When getaddrinfo() failed, the context object was not released before returning NULL. Coverity scan has detected this with CID 1458398. --- examples/coap-server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/coap-server.c b/examples/coap-server.c index ebbb9ca6..bf6b9b56 100644 --- a/examples/coap-server.c +++ b/examples/coap-server.c @@ -358,6 +358,7 @@ get_context(const char *node, const char *port) { s = getaddrinfo(node, port, &hints, &result); if ( s != 0 ) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(s)); + coap_free_context(ctx); return NULL; }