From bb2e2ff997c3645a673c222e5b7e9a450e245173 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sat, 31 Oct 2020 19:59:57 +0100 Subject: [PATCH] Cedar/Session.c: fix "use after free" in CleanupSession() Fixes #1226. --- src/Cedar/Session.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Cedar/Session.c b/src/Cedar/Session.c index 7548612a..21b6aefe 100644 --- a/src/Cedar/Session.c +++ b/src/Cedar/Session.c @@ -1223,6 +1223,9 @@ void CleanupSession(SESSION *s) // Release the client connection options if (s->ClientOption != NULL) { +#ifdef OS_UNIX + UnixVLanSetState(s->ClientOption->DeviceName, false); +#endif Free(s->ClientOption); } @@ -1278,12 +1281,7 @@ void CleanupSession(SESSION *s) { FreePacketAdapter(s->PacketAdapter); } -#ifdef OS_UNIX - if (s->ClientOption != NULL) - { - UnixVLanSetState(s->ClientOption->DeviceName, false); - } -#endif + if (s->OldTraffic != NULL) { FreeTraffic(s->OldTraffic);