diff --git a/src/netif/ppp/vj.c b/src/netif/ppp/vj.c index 3fc1a4c9..90f620f0 100644 --- a/src/netif/ppp/vj.c +++ b/src/netif/ppp/vj.c @@ -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 * 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) { return (TYPE_IP); } - if (pbuf_copy(np, *pb) != ERR_OK) { - pbuf_free(np); - return (TYPE_IP); - } - *pb = np; ip = (struct ip_hdr *)np->payload;