mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
PPP, VJ: Use pbuf_clone to replace pbuf_alloc+pbuf_copy
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
parent
ecd6c7ceae
commit
a92a281455
@ -202,16 +202,11 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf **pb)
|
|||||||
|
|
||||||
/* TCP stack requires that we don't change the packet payload, therefore we copy
|
/* TCP stack requires that we don't change the packet payload, therefore we copy
|
||||||
* the whole packet before compression. */
|
* the whole packet before compression. */
|
||||||
np = pbuf_alloc(PBUF_RAW, np->tot_len, PBUF_POOL);
|
np = pbuf_clone(PBUF_RAW, PBUF_POOL, *pb);
|
||||||
if (!np) {
|
if (!np) {
|
||||||
return (TYPE_IP);
|
return (TYPE_IP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pbuf_copy(np, *pb) != ERR_OK) {
|
|
||||||
pbuf_free(np);
|
|
||||||
return (TYPE_IP);
|
|
||||||
}
|
|
||||||
|
|
||||||
*pb = np;
|
*pb = np;
|
||||||
ip = (struct ip_hdr *)np->payload;
|
ip = (struct ip_hdr *)np->payload;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user