From 92e8ad4bd6e9f93d7c2ba2d6f6b93c408995b2f6 Mon Sep 17 00:00:00 2001 From: Gene Van Buren <85305093+genevb@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:51:28 -0400 Subject: [PATCH] Fix segfault in unused StSvtSeqAdjMaker (#576) In some bfc.C tests, this maker may get instantiated but, Init() is never called. Pointers not initialized to NULL in the constructor may potentially be non-zero in the destructor, leading to needless seg faults when quitting root4star. Simple test: root4star -b -q -l 'bfc.C(-1)' --- StRoot/StSvtSeqAdjMaker/StSvtSeqAdjMaker.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StRoot/StSvtSeqAdjMaker/StSvtSeqAdjMaker.cxx b/StRoot/StSvtSeqAdjMaker/StSvtSeqAdjMaker.cxx index 13d9218eaec..ec3fccb235e 100644 --- a/StRoot/StSvtSeqAdjMaker/StSvtSeqAdjMaker.cxx +++ b/StRoot/StSvtSeqAdjMaker/StSvtSeqAdjMaker.cxx @@ -221,6 +221,7 @@ StSvtSeqAdjMaker::StSvtSeqAdjMaker(const char *name) : StMaker(name) // Set up some defaults mPedFile = NULL; + hfile = NULL; mPedOffSet = 20; m_thresh_lo = 3+mPedOffSet; m_thresh_hi = 5+mPedOffSet; @@ -237,7 +238,6 @@ StSvtSeqAdjMaker::~StSvtSeqAdjMaker(){ Int_t StSvtSeqAdjMaker::Init(){ - hfile = NULL; GetSvtRawData(); SetSvtData();