From a92a2814554494738782ea5a5d386302b9dd5aed Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 2 Jul 2017 23:39:01 +0800 Subject: [PATCH] PPP, VJ: Use pbuf_clone to replace pbuf_alloc+pbuf_copy Signed-off-by: Axel Lin Signed-off-by: goldsimon --- src/netif/ppp/vj.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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;