mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-07 18:12:55 +03:00
net.c: memory leak in handle_request if error input
coap_add_token() can error for multiple reasons when building the response PDU - but then the response PDU is not deleted on error if it exists. The PDU is now deleted on coap_add_token() error.
This commit is contained in:
1 parent
cbc3430ade
commit
b3eacf2eac
1 file changed
+2
-1
@@ -2363,10 +2363,11 @@ handle_request(coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu
|
||||
} else {
|
||||
coap_delete_pdu(response);
|
||||
}
|
||||
response = NULL;
|
||||
} else {
|
||||
coap_log(LOG_WARNING, "cannot generate response\r\n");
|
||||
coap_delete_pdu(response);
|
||||
}
|
||||
response = NULL;
|
||||
} else {
|
||||
if (coap_string_equal(uri_path, &coap_default_uri_wellknown)) {
|
||||
/* request for .well-known/core */
|
||||
|
||||
Reference in new issue
Block a user