diff options
author | Christian Geddes <crgeddes@us.ibm.com> | 2017-09-08 10:22:52 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-09-25 11:54:57 -0400 |
commit | 1b3b999258db544d6af1dbfb7ee3437efd17581b (patch) | |
tree | 1cb96dd1838af832ef630398c93cfedeaafda3ef /src/usr/pnor | |
parent | ac058e9b3c6d1d5d57089d42cbb75b76f36d24a2 (diff) | |
download | talos-hostboot-1b3b999258db544d6af1dbfb7ee3437efd17581b.tar.gz talos-hostboot-1b3b999258db544d6af1dbfb7ee3437efd17581b.zip |
Set variables to nullptr after they are deleted
While updating some LPC logic a developer noticed a bug where
an errlog handle wasnt getting set to nullptr after it was deleted
this caused a confusing bug that took awhile to track. I noticed
that this bug was all over our code so this commit fixes a lot of
cases where variables get deleted but not set to nullptr
Change-Id: I103b5c71b93686c3c89b04d1d565a24d4de74e6f
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45890
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/pnor')
-rw-r--r-- | src/usr/pnor/ast_mboxdd.C | 1 | ||||
-rw-r--r-- | src/usr/pnor/nor_micron.C | 9 | ||||
-rw-r--r-- | src/usr/pnor/sfc_ast2X00.C | 3 | ||||
-rw-r--r-- | src/usr/pnor/sfc_ibm.C | 3 |
4 files changed, 10 insertions, 6 deletions
diff --git a/src/usr/pnor/ast_mboxdd.C b/src/usr/pnor/ast_mboxdd.C index a515a81a9..df9b6c991 100644 --- a/src/usr/pnor/ast_mboxdd.C +++ b/src/usr/pnor/ast_mboxdd.C @@ -168,6 +168,7 @@ errlHndl_t astMbox::doMessage(mboxMessage& io_msg) // memory leak. Let error below be the one committed. TRACFCOMP( g_trac_pnor, "Error communicating with MBOX daemon"); delete l_err; + l_err = nullptr; } /*@ diff --git a/src/usr/pnor/nor_micron.C b/src/usr/pnor/nor_micron.C index fc0d1197d..cb0fdedb5 100644 --- a/src/usr/pnor/nor_micron.C +++ b/src/usr/pnor/nor_micron.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -51,7 +51,7 @@ errlHndl_t micronCheckForWorkarounds( SfcDD* i_sfc, // HW workaround - run this command before reading out chipid l_err = micronFlagStatus( i_sfc ); - if(l_err) { delete l_err; } + if(l_err) { delete l_err; l_err = nullptr; } uint32_t outdata[4]; @@ -78,7 +78,7 @@ errlHndl_t micronCheckForWorkarounds( SfcDD* i_sfc, //Prove this works l_err = micronFlagStatus( i_sfc ); - if(l_err) { delete l_err; } + if(l_err) { delete l_err; l_err = nullptr; } } while(0); @@ -121,7 +121,7 @@ errlHndl_t micronFlagStatus( SfcDD* i_sfc ) SfcDD::NO_ADDRESS, 0, NULL, 6, reinterpret_cast<uint8_t*>(outdata) ); - if( l_err ) { delete l_err; } + if( l_err ) { delete l_err; l_err = nullptr; } /*@ * @errortype @@ -157,6 +157,7 @@ errlHndl_t micronFlagStatus( SfcDD* i_sfc ) if( l_err ) { delete l_err; + l_err = nullptr; } else { diff --git a/src/usr/pnor/sfc_ast2X00.C b/src/usr/pnor/sfc_ast2X00.C index 4efededb4..b976a7cc6 100644 --- a/src/usr/pnor/sfc_ast2X00.C +++ b/src/usr/pnor/sfc_ast2X00.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -559,6 +559,7 @@ void SfcAST2X00::addFFDC( errlHndl_t& io_errhdl ) if( l_err ) { delete l_err; + l_err = nullptr; } else { diff --git a/src/usr/pnor/sfc_ibm.C b/src/usr/pnor/sfc_ibm.C index a13a378f5..24ea7eb9c 100644 --- a/src/usr/pnor/sfc_ibm.C +++ b/src/usr/pnor/sfc_ibm.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2016 */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -861,6 +861,7 @@ errlHndl_t SfcIBM::checkForErrors( ResetLevels &o_resetLevel ) { TRACFCOMP( g_trac_pnor, ERR_MRK"SfcIBM::checkForErrors> Deleting register read error. Returning error created for the found error"); delete l_err; + l_err = nullptr; } |