From 18e5718c977adc1ca0d7217398eb0e93163bf502 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 27 Apr 2010 13:08:55 +0000 Subject: [PATCH] avoid freeing queuebuf multiple times, and free buffer after cancelling connection --- core/net/rime/stunicast.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/net/rime/stunicast.c b/core/net/rime/stunicast.c index a7e3e426e..0caa50ab7 100644 --- a/core/net/rime/stunicast.c +++ b/core/net/rime/stunicast.c @@ -33,7 +33,7 @@ * * 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) { unicast_close(&c->c); - ctimer_stop(&c->t); - if(c->buf != NULL) { - queuebuf_free(c->buf); - } + stunicast_cancel(c); } /*---------------------------------------------------------------------------*/ rimeaddr_t * @@ -168,6 +165,10 @@ void stunicast_cancel(struct stunicast_conn *c) { ctimer_stop(&c->t); + if(c->buf != NULL) { + queuebuf_free(c->buf); + c->buf = NULL; + } } /*---------------------------------------------------------------------------*/ /** @} */