CSMA bugfix: do not use field on a struct that may have been deallocated

This commit is contained in:
Simon Duquennoy 2017-01-05 10:45:47 +01:00
parent 6e07fd7019
commit 0de3563ddb
1 changed files with 3 additions and 1 deletions

View File

@ -231,10 +231,12 @@ tx_done(int status, struct rdc_buf_list *q, struct neighbor_queue *n)
mac_callback_t sent; mac_callback_t sent;
struct qbuf_metadata *metadata; struct qbuf_metadata *metadata;
void *cptr; void *cptr;
uint8_t ntx;
metadata = (struct qbuf_metadata *)q->ptr; metadata = (struct qbuf_metadata *)q->ptr;
sent = metadata->sent; sent = metadata->sent;
cptr = metadata->cptr; cptr = metadata->cptr;
ntx = n->transmissions;
switch(status) { switch(status) {
case MAC_TX_OK: 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); free_packet(n, q, status);
mac_call_sent_callback(sent, cptr, status, n->transmissions); mac_call_sent_callback(sent, cptr, status, ntx);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void