mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-23 07:35:13 +03:00
mem: Use coap_malloc_type() and coap_free_type() in libcoap
The use of coap_malloc() and coap_free() does not work with environments that have their own memory managers (e.g. LwIP). Convert coap_malloc() to coap_malloc_type(COAP_STRING,) and coap_free() to coap_free_type(COAP_STRING,) in the library.
This commit is contained in:
1 parent
48c8eb0b3c
commit
f6aebcbff7
8 files changed
+19
-19
No files matched your search
+2
-2
@@ -49,11 +49,11 @@ coap_cache_ignore_options(coap_context_t *ctx,
|
||||
const uint16_t *options,
|
||||
size_t count) {
|
||||
if (ctx->cache_ignore_options) {
|
||||
coap_free(ctx->cache_ignore_options);
|
||||
coap_free_type(COAP_STRING, ctx->cache_ignore_options);
|
||||
}
|
||||
if (count) {
|
||||
assert(options);
|
||||
ctx->cache_ignore_options = coap_malloc(count * sizeof(options[0]));
|
||||
ctx->cache_ignore_options = coap_malloc_type(COAP_STRING, count * sizeof(options[0]));
|
||||
if (ctx->cache_ignore_options) {
|
||||
memcpy(ctx->cache_ignore_options, options, count * sizeof(options[0]));
|
||||
ctx->cache_ignore_count = count;
|
||||
|
||||
Reference in new issue
Block a user