Bug Summary

File:daq/expreco/modules/src/ReceiveEvent.cc
Warning:line 105, column 7
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -O3 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name ReceiveEvent.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/data/b2soft/buildbot/development/build -fcoverage-compilation-dir=/data/b2soft/buildbot/development/build -resource-dir /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++ -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/x86_64-redhat-linux -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/backward -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/python3.12 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/CLHEP -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/Geant4 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/root -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/belle_legacy -I include/ -D _PACKAGE_="daq" -D G4UI_USE_TCSH -D RaveDllExport= -D HAS_SQLITE -D HAS_CALLGRIND -I include -I /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/libxml2 -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++ -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/x86_64-redhat-linux -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/backward -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-missing-braces -Wno-unused-command-line-argument -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /scan_build/2026-05-31-004316-385593-1 -x c++ daq/expreco/modules/src/ReceiveEvent.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <daq/expreco/modules/ReceiveEvent.h>
10
11#include <TSystem.h>
12
13#include <stdlib.h>
14
15//#define MAXEVTSIZE 400000000
16
17using namespace std;
18using namespace Belle2;
19
20//-----------------------------------------------------------------
21// Register the Module
22//-----------------------------------------------------------------
23REG_MODULE(ReceiveEvent)namespace { struct ModuleProxyReceiveEvent: public ModuleProxyBase
{ ModuleProxyReceiveEvent(): ModuleProxyBase("ReceiveEvent",
"" "daq") {} virtual ::Belle2::Module* createInstance() const
override final { return new ReceiveEventModule(); } } proxyReceiveEventModule
; }
;
24
25//-----------------------------------------------------------------
26// Implementation
27//-----------------------------------------------------------------
28
29ReceiveEventModule::ReceiveEventModule() : Module()
30{
31 //Set module properties
32 setDescription("Receive Event from ExpReco");
33 // setPropertyFlags(c_Input | c_ParallelProcessingCertified);
34
35 addParam("Host", m_host, "Receiver host", string("expreco"));
36 addParam("Port", m_port, "Receiver Port", 7111);
37 m_nrecv = 0;
38 m_compressionLevel = 0;
39
40 //Parameter definition
41 B2INFO("Rx: Constructor done.")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "Rx: Constructor done."; Belle2::LogSystem
::Instance().sendMessage(Belle2::LogMessage(Belle2::LogConfig
::c_Info, std::move(varStream), "daq", __PRETTY_FUNCTION__, "daq/expreco/modules/src/ReceiveEvent.cc"
, 41, 0)); }; } } while(false)
;
42}
43
44
45ReceiveEventModule::~ReceiveEventModule()
46{
47}
48
49void ReceiveEventModule::initialize()
50{
51 // Load data objects definitions
52 gSystem->Load("libdataobjects");
53
54 // Open receiving socekt
55 m_recv = new EvtSocketSend(m_host.c_str(), m_port);
56
57 // Initialize DataStoreStreamer
58 m_streamer = new DataStoreStreamer(m_compressionLevel);
59
60 // Prefetch first record in ReceiveEvent
61 EvtMessage* msg = m_recv->recv();
62 if (msg == NULL__null) {
63 B2FATAL("Did not receive any data, stopping initialization.")do { { LogVariableStream varStream; varStream << "Did not receive any data, stopping initialization."
; Belle2::LogSystem::Instance().sendMessage(Belle2::LogMessage
(Belle2::LogConfig::c_Fatal, std::move(varStream), "daq", __PRETTY_FUNCTION__
, "daq/expreco/modules/src/ReceiveEvent.cc", 63, 0)); }; exit
(1); } while(false)
;
64 return;
65 }
66 m_streamer->restoreDataStore(msg);
67
68 // Delete buffers
69 delete msg;
70
71 m_nrecv = -1;
72
73 B2INFO("Rx initialized.")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "Rx initialized."; Belle2::LogSystem::Instance
().sendMessage(Belle2::LogMessage(Belle2::LogConfig::c_Info, std
::move(varStream), "daq", __PRETTY_FUNCTION__, "daq/expreco/modules/src/ReceiveEvent.cc"
, 73, 0)); }; } } while(false)
;
74}
75
76
77void ReceiveEventModule::beginRun()
78{
79 B2INFO("beginRun called.")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "beginRun called."; Belle2::LogSystem::Instance
().sendMessage(Belle2::LogMessage(Belle2::LogConfig::c_Info, std
::move(varStream), "daq", __PRETTY_FUNCTION__, "daq/expreco/modules/src/ReceiveEvent.cc"
, 79, 0)); }; } } while(false)
;
80}
81
82
83void ReceiveEventModule::event()
84{
85 m_nrecv++;
86 // First event is already loaded
87 if (m_nrecv == 0) return;
1
Assuming field 'm_nrecv' is not equal to 0
2
Taking false branch
88
89 // Get a record from socket
90 EvtMessage* msg = m_recv->recv();
3
'msg' initialized here
91 if (msg == NULL__null) {
4
Assuming 'msg' is equal to NULL
5
Taking true branch
92 printf("Connection is closed. Reconnecting.\n");
93 int nrepeat = 5000;
94 for (;;) {
6
Loop condition is true. Entering loop body
95 int rstat = (m_recv->sock())->reconnect(nrepeat);
96 if (rstat == - 1)
7
Assuming the condition is false
8
Taking false branch
97 continue;
98 else
99 break;
100 }
101 // return;
102 }
103 B2INFO("Rx: got an event from Socket, size=" << msg->size())do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "Rx: got an event from Socket, size=" <<
msg->size(); Belle2::LogSystem::Instance().sendMessage(Belle2
::LogMessage(Belle2::LogConfig::c_Info, std::move(varStream),
"daq", __PRETTY_FUNCTION__, "daq/expreco/modules/src/ReceiveEvent.cc"
, 103, 0)); }; } } while(false)
;
9
Taking false branch
10
Loop condition is false. Exiting loop
104 // Check for termination record
105 if (msg->type() == MSG_TERMINATE) {
11
Called C++ object pointer is null
106 B2INFO("Rx: got termination message. Exitting....")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "Rx: got termination message. Exitting...."
; Belle2::LogSystem::Instance().sendMessage(Belle2::LogMessage
(Belle2::LogConfig::c_Info, std::move(varStream), "daq", __PRETTY_FUNCTION__
, "daq/expreco/modules/src/ReceiveEvent.cc", 106, 0)); }; } }
while(false)
;
107 return;
108 // Flag End Of File !!!!!
109 // return msg->type(); // EOF
110 }
111
112 // Restore DataStore
113 m_streamer->restoreDataStore(msg);
114 B2INFO("Rx: DataStore Restored!!")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "Rx: DataStore Restored!!"; Belle2::LogSystem
::Instance().sendMessage(Belle2::LogMessage(Belle2::LogConfig
::c_Info, std::move(varStream), "daq", __PRETTY_FUNCTION__, "daq/expreco/modules/src/ReceiveEvent.cc"
, 114, 0)); }; } } while(false)
;
115
116 // Delete EvtMessage
117 delete msg;
118
119 return;
120}
121
122void ReceiveEventModule::endRun()
123{
124 //fill Run data
125
126 B2INFO("endRun done.")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "endRun done."; Belle2::LogSystem::Instance
().sendMessage(Belle2::LogMessage(Belle2::LogConfig::c_Info, std
::move(varStream), "daq", __PRETTY_FUNCTION__, "daq/expreco/modules/src/ReceiveEvent.cc"
, 126, 0)); }; } } while(false)
;
127}
128
129
130void ReceiveEventModule::terminate()
131{
132 B2INFO("terminate called")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "daq")) { { LogVariableStream varStream
; varStream << "terminate called"; Belle2::LogSystem::Instance
().sendMessage(Belle2::LogMessage(Belle2::LogConfig::c_Info, std
::move(varStream), "daq", __PRETTY_FUNCTION__, "daq/expreco/modules/src/ReceiveEvent.cc"
, 132, 0)); }; } } while(false)
;
133}
134