From 450abe615498185a5555aef6a51474ca5a6e084b Mon Sep 17 00:00:00 2001
From: Martine Lenders <mlenders@inf.fu-berlin.de>
Date: Tue, 28 Apr 2015 14:51:06 +0200
Subject: [PATCH] ng_sixlowpan: use ng_pktbuf_remove_snip()

---
 sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c b/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
index cbcbfb13b6..adcf74197c 100644
--- a/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
+++ b/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
@@ -78,8 +78,14 @@ void _receive(ng_pktsnip_t *pkt)
         /* packet is uncompressed: just mark and remove the dispatch */
         sixlowpan = ng_pktbuf_add(payload, payload->data, sizeof(uint8_t),
                                   NG_NETTYPE_SIXLOWPAN);
-        LL_DELETE(pkt, sixlowpan);
-        ng_pktbuf_release(sixlowpan);
+
+        if (sixlowpan == NULL) {
+            DEBUG("6lo: can not mark 6LoWPAN dispatch\n");
+            ng_pktbuf_release(pkt);
+            return;
+        }
+
+        pkt = ng_pktbuf_remove_snip(pkt, sixlowpan);
     }
 #ifdef MODULE_NG_SIXLOWPAN_FRAG
     else if (ng_sixlowpan_frag_is((ng_sixlowpan_frag_t *)dispatch)) {
-- 
GitLab