mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-12 11:40:39 +03:00
resource.c: Fix memory leak in coap_add_observer()
If no observer exists, a new cache key is created and storage for a new subscription may be allocated. If this fails, the newly created cache key must be released. This fixes CID 1504918.
This commit is contained in:
1 parent
ead82c4049
commit
90537d143a
1 file changed
+1
@@ -759,6 +759,7 @@ static const uint16_t cache_ignore_options[] = { COAP_OPTION_ETAG };
|
||||
s = COAP_MALLOC_TYPE(subscription);
|
||||
|
||||
if (!s) {
|
||||
coap_delete_cache_key(cache_key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user