Skip to content

Commit

Permalink
CSMA bugfix: do not use field on a struct that may have been deallocated
Browse files Browse the repository at this point in the history
  • Loading branch information
simonduq committed Jan 5, 2017
1 parent 6e07fd7 commit 0de3563
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/net/mac/csma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 0de3563

Please sign in to comment.