mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-03 03:01:05 +03:00
resource.c: bugfix: Memory leak from hash table
The function coap_delete_all_resources() did not free the hash buckets created by HASH_ADD. Thus, the iterator must call HASH_DELETE to free the allocated storage. This bug has been discovered by Jean-Michel Julien <Jean-Michel.Julien@trilliantinc.com> who also provided this fix. See [1] for more information. [1] https://sourceforge.net/p/libcoap/mailman/message/34994226/
This commit is contained in:
1 parent
4a5f381978
commit
7dea55099f
1 file changed
+1
@@ -457,6 +457,7 @@ coap_delete_all_resources(coap_context_t *context) {
|
||||
LL_FOREACH_SAFE(context->resources, res, rtmp) {
|
||||
#else
|
||||
HASH_ITER(hh, context->resources, res, rtmp) {
|
||||
HASH_DELETE(hh, context->resources, res);
|
||||
#endif
|
||||
coap_free_resource(res);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user