net: buf: fix data ref_count offset in generic_data_ref()

This patch fixes commit b70f92e570
("net: buf: keep memory alignment provided by k_heap_alloc and k_malloc").
One-line was overlooked in the above patch and may result in a
cloned net_buf using a data block that has already been freed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2023-05-31 14:25:56 +02:00 committed by Anas Nashif
parent 064d9f4dd8
commit 02129e90d8
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ static uint8_t *generic_data_ref(struct net_buf *buf, uint8_t *data)
{
uint8_t *ref_count;
ref_count = data - 1;
ref_count = data - sizeof(void *);
(*ref_count)++;
return data;