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.
This commit is contained in:
Olaf Bergmann committed 2017-11-03 14:18:19 +01:00
1 parent 29692faa86
commit edca08249b
1 file changed
+1
+1
View File
@@ -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;
}