From 3ec6dffbf1bea4ed7fac84e1af3deace3683aa04 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Fri, 26 Jul 2019 12:45:59 +0200 Subject: [PATCH] coap-server.c: Fix memory leak in hnd_put() hnd_put() creates a new string object for the request's URI path. When the permittwed number of dynamic resources was exceeded, this object must be released manually. This fixed CID 1483553 reported by Coverity scan. --- examples/coap-server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/coap-server.c b/examples/coap-server.c index d85cc53d..4723d2bc 100644 --- a/examples/coap-server.c +++ b/examples/coap-server.c @@ -440,6 +440,7 @@ hnd_put(coap_context_t *ctx UNUSED_PARAM, if (dynamic_count >= support_dynamic) { /* Should have been caught in hnd_unknown_put() */ response->code = COAP_RESPONSE_CODE(406); + coap_delete_string(uri_path); return; } dynamic_count++;