bug #26027: netbuf_chain resulted in pbuf memory leak

This commit is contained in:
goldsimon 2009-04-15 14:57:32 +00:00
parent b3a5d6df0d
commit dbd6d7ec8d
2 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,9 @@ HISTORY
++ New features: ++ New features:
2009-04-15 Simon Goldschmidt
* netbuf.c: bug #26027: netbuf_chain resulted in pbuf memory leak
2009-04-15 Simon Goldschmidt 2009-04-15 Simon Goldschmidt
* sockets.c, ppp.c: bug #25763: corrected 4 occurrences of SMEMCPY to MEMCPY * sockets.c, ppp.c: bug #25763: corrected 4 occurrences of SMEMCPY to MEMCPY

View File

@ -158,14 +158,14 @@ netbuf_ref(struct netbuf *buf, const void *dataptr, u16_t size)
* Chain one netbuf to another (@see pbuf_chain) * Chain one netbuf to another (@see pbuf_chain)
* *
* @param head the first netbuf * @param head the first netbuf
* @param tail netbuf to chain after head * @param tail netbuf to chain after head, freed by this function, may not be reference after returning
*/ */
void void
netbuf_chain(struct netbuf *head, struct netbuf *tail) netbuf_chain(struct netbuf *head, struct netbuf *tail)
{ {
LWIP_ERROR("netbuf_ref: invalid head", (head != NULL), return;); LWIP_ERROR("netbuf_ref: invalid head", (head != NULL), return;);
LWIP_ERROR("netbuf_chain: invalid tail", (tail != NULL), return;); LWIP_ERROR("netbuf_chain: invalid tail", (tail != NULL), return;);
pbuf_chain(head->p, tail->p); pbuf_cat(head->p, tail->p);
head->ptr = head->p; head->ptr = head->p;
memp_free(MEMP_NETBUF, tail); memp_free(MEMP_NETBUF, tail);
} }