From 930d5a879e1f1b7601ae6401a02416f422ceea5a Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sun, 17 Nov 2019 12:13:17 -0600 Subject: [PATCH] Fix use of object after destructor in HcalHardcodeCalibrations The temporarily created ESConsumesCollector is held by reference but goes away on that line (since the compiler does not know it must extend the lifetime of the object returned by setWhatProduced). The problem was found by the address sanitizer. --- CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc index 957d802931f57..2461f2b7c45cd 100644 --- a/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc +++ b/CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc @@ -239,7 +239,8 @@ HcalHardcodeCalibrations::HcalHardcodeCalibrations(const edm::ParameterSet& iCon findingRecord(); } if ((objectName == "RespCorrs") || (objectName == "ResponseCorrection") || all) { - auto& c = setWhatProduced(this, &HcalHardcodeCalibrations::produceRespCorrs).setConsumes(topoTokens_[kRespCorrs]); + auto c = setWhatProduced(this, &HcalHardcodeCalibrations::produceRespCorrs); + c.setConsumes(topoTokens_[kRespCorrs]); if (he_recalibration) { c.setConsumes(heDarkeningToken_, edm::ESInputTag("", "HE")); }