From: Abhimanyu Vishwakarma Date: Tue, 3 Jan 2017 06:07:05 +0000 (+0530) Subject: ubus: ubus_free: clear pending timers before freeing context X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=ad5333a73b222e95458e05d52f349194df9ae7c6;p=project%2Fubus.git ubus: ubus_free: clear pending timers before freeing context If a synchronous operation is executed on a ubus context after uloop_done() has been called, the context's pending_timer may remain in uloop's list of timeouts. This leads to undefined behaviour during next execution of uloop code, as it may be referring to unavailable memory or memory that has been allocated for different purposes. Signed-off-by: Marcin Nowakowski Signed-off-by: Abhimanyu Vishwakarma --- diff --git a/libubus.c b/libubus.c index b25d8b0..51a1483 100644 --- a/libubus.c +++ b/libubus.c @@ -362,6 +362,7 @@ void ubus_shutdown(struct ubus_context *ctx) if (!ctx) return; close(ctx->sock.fd); + uloop_timeout_cancel(&ctx->pending_timer); free(ctx->msgbuf.data); }