|
From: | Mike Rosing |
Subject: | [lwip-users] Pbuf_cat and pbuf_free question |
Date: | Mon, 9 Oct 2017 16:12:44 -0500 (CDT) |
I'm not sure if my problem is a memory leak or buffer overflow since the error occurs in system free() with garbage in the memory chain. The difference I've added (among other things) is the use of PBUF_REF and pbuf_cat(). The following sequence works fine, but is it correct?
ref = pbuf_alloc(PBUF_RAW, 1024, PBUF_REF);
ref->payload = upptr;
pbuf_cat(head, ref);
udp_sendto(udp_raw, head, server, port);
pbuf_free(head);
I do NOT have pbuf_free(ref) because according the manual I'm not supposed to reference it again after using pbuf_cat(). Am I creating a memory leak, or is this OK?
Mike
[Prev in Thread] | Current Thread | [Next in Thread] |