From 19da4355ee975c714f0f11d31c8b41c3fdabd913 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 9 Mar 2015 09:55:57 -0700 Subject: [PATCH] Clear ListenTransConns entries in CloseWellKnownConnections Since _XSERVTransClose frees the connection pointer passed to it, remove that pointer from the array, so we don't try to double free it if we come back into CloseWellKnownConnections again. Should fix https://bugzilla.yoctoproject.org/show_bug.cgi?id=6665 in which the shutdown section of the main() loop called CloseWellKnownConnections() and then moved on to ddxGiveUp(), which failed to release the VT and thus called AbortServer(), which called CloseWellKnownConnections() again. Signed-off-by: Alan Coopersmith Reviewed-by: Adam Jackson Signed-off-by: Peter Hutterer (cherry picked from commit 7ea64fb4374504bd3d524fc08c90efdab9f253ea) --- os/connection.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/os/connection.c b/os/connection.c index da3397da6..64c83fccb 100644 --- a/os/connection.c +++ b/os/connection.c @@ -519,8 +519,13 @@ CloseWellKnownConnections(void) { int i; - for (i = 0; i < ListenTransCount; i++) - _XSERVTransClose(ListenTransConns[i]); + for (i = 0; i < ListenTransCount; i++) { + if (ListenTransConns[i] != NULL) { + _XSERVTransClose(ListenTransConns[i]); + ListenTransConns[i] = NULL; + } + } + ListenTransCount = 0; } static void