From 0de3563ddbb191cf20c38a39ca280235e04c74d0 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 5 Jan 2017 10:45:47 +0100 Subject: [PATCH] CSMA bugfix: do not use field on a struct that may have been deallocated --- core/net/mac/csma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/net/mac/csma.c b/core/net/mac/csma.c index eea86b4e8..9a3561928 100644 --- a/core/net/mac/csma.c +++ b/core/net/mac/csma.c @@ -231,10 +231,12 @@ tx_done(int status, struct rdc_buf_list *q, struct neighbor_queue *n) mac_callback_t sent; struct qbuf_metadata *metadata; void *cptr; + uint8_t ntx; metadata = (struct qbuf_metadata *)q->ptr; sent = metadata->sent; cptr = metadata->cptr; + ntx = n->transmissions; switch(status) { case MAC_TX_OK: @@ -251,7 +253,7 @@ tx_done(int status, struct rdc_buf_list *q, struct neighbor_queue *n) } free_packet(n, q, status); - mac_call_sent_callback(sent, cptr, status, n->transmissions); + mac_call_sent_callback(sent, cptr, status, ntx); } /*---------------------------------------------------------------------------*/ static void