avoid freeing queuebuf multiple times, and free buffer after cancelling connection
This commit is contained in:
parent
12b6f35ce7
commit
18e5718c97
|
@ -33,7 +33,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: stunicast.c,v 1.4 2010/02/23 18:38:05 adamdunkels Exp $
|
* $Id: stunicast.c,v 1.5 2010/04/27 13:08:55 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,10 +95,7 @@ void
|
||||||
stunicast_close(struct stunicast_conn *c)
|
stunicast_close(struct stunicast_conn *c)
|
||||||
{
|
{
|
||||||
unicast_close(&c->c);
|
unicast_close(&c->c);
|
||||||
ctimer_stop(&c->t);
|
stunicast_cancel(c);
|
||||||
if(c->buf != NULL) {
|
|
||||||
queuebuf_free(c->buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
rimeaddr_t *
|
rimeaddr_t *
|
||||||
|
@ -168,6 +165,10 @@ void
|
||||||
stunicast_cancel(struct stunicast_conn *c)
|
stunicast_cancel(struct stunicast_conn *c)
|
||||||
{
|
{
|
||||||
ctimer_stop(&c->t);
|
ctimer_stop(&c->t);
|
||||||
|
if(c->buf != NULL) {
|
||||||
|
queuebuf_free(c->buf);
|
||||||
|
c->buf = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
Loading…
Reference in a new issue