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:
Olaf Bergmann committed 2016-12-01 14:50:16 +01:00
1 parent 4721d5d527
commit 41af3304f0
1 file changed
+6 -1
+6 -1
View File
@@ -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