From f7f552ad8e98eeb6337af97a5f7dc6b60988171c Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Thu, 23 Jun 2022 21:05:26 +0000 Subject: [PATCH] Debian: Fix mtcAgent segfault on SM host state change requests The mtcAgent communicates to Service Managenment using libEvent. The host state change notification requests are all blocking requests. Both the common and service manager handlers are freeing the object. This double free results in a segmentation fault with the newer version of libEvent in Debian. The bug is fixed by removing the free in the service handler to allow the dispatch handler to manage the object free as it does for other blocking requests for other services. Test Plan: PASS: Verify mtcAgent does not crash on SM state change request PASS: Verify all blocking state change requests PASS: Verify no memory leak (before ; request stress ; after) Regression: PASS: Verify Debian Build and Install (duplex/duplex) PASS: Verify CentOS Build and Patch (duplex) PASS: Verify CentOS Swact PASS: Verify Logging Story: 2009968 Task: 45675 Signed-off-by: Eric MacDonald Change-Id: Iad27a0e77cb9d2233a2f2e1b6f8216b93964335b --- mtce/src/maintenance/mtcSmgrApi.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/mtce/src/maintenance/mtcSmgrApi.cpp b/mtce/src/maintenance/mtcSmgrApi.cpp index 9fd4ddc7..8346f678 100644 --- a/mtce/src/maintenance/mtcSmgrApi.cpp +++ b/mtce/src/maintenance/mtcSmgrApi.cpp @@ -62,9 +62,6 @@ mtcSmgrApi_handler_out: if ( smgrEvent.blocking == true ) { - mtcHttpUtil_free_conn ( smgrEvent ); - mtcHttpUtil_free_base ( smgrEvent ); - /* This is needed to get out of the loop in the blocking case * Calling this here in non-blocking calls can lead to segfault */ event_base_loopbreak((struct event_base *)arg);