Skip to content

Commit

Permalink
Zephyr: Fix k_realloc build errors for zephyr < 3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdeep1 committed Sep 4, 2024
1 parent eaff692 commit 493b503
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/coap_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,16 @@ coap_realloc_type(coap_memory_tag_t type, void *p, size_t size) {
void *ptr;

(void)type;
#if KERNEL_VERSION_NUMBER >= 0x30700
ptr = k_realloc(p, size);
#else /* KERNEL_VERSION_NUMBER < 0x30700 */
if (!p) {
ptr = k_malloc(size);
} else {
/* Unfortunately do not know original size of p to take a copy of it */
ptr = NULL;
}
#endif /* KERNEL_VERSION_NUMBER < 0x30700 */
#if COAP_MEMORY_TYPE_TRACK
if (ptr) {
assert(type < COAP_MEM_TAG_LAST);
Expand Down

0 comments on commit 493b503

Please sign in to comment.