mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-08 10:32:53 +03:00
net.c: explicitly clear pointer to free'd storage
Static code analysis tools have incorrectly reported a memory leak in function handle_request(). To avoid this false positive, the variable response is explicitly set to NULL after releasing the memory with coap_delete_pdu().
This commit is contained in:
1 parent
4721d5d527
commit
41af3304f0
1 file changed
+6
-1
@@ -1425,6 +1425,7 @@ handle_request(coap_context_t *context, coap_queue_t *node) {
|
||||
warn("cannot send response for transaction %u\n", node->id);
|
||||
}
|
||||
coap_delete_pdu(response);
|
||||
response = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1509,6 +1510,7 @@ handle_request(coap_context_t *context, coap_queue_t *node) {
|
||||
}
|
||||
}
|
||||
coap_delete_pdu(response);
|
||||
response = NULL;
|
||||
} else {
|
||||
warn("cannot generate response\r\n");
|
||||
}
|
||||
@@ -1528,7 +1530,10 @@ handle_request(coap_context_t *context, coap_queue_t *node) {
|
||||
}
|
||||
}
|
||||
coap_delete_pdu(response);
|
||||
}
|
||||
response = NULL;
|
||||
}
|
||||
|
||||
assert(response == NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
Reference in new issue
Block a user