diff options
-rw-r--r-- | src/usr/console/console.C | 5 | ||||
-rw-r--r-- | src/usr/errl/errlmanager.C | 6 | ||||
-rw-r--r-- | src/usr/runtime/populate_hbruntime.C | 4 | ||||
-rw-r--r-- | src/usr/trace/daemonif.C | 8 |
4 files changed, 20 insertions, 3 deletions
diff --git a/src/usr/console/console.C b/src/usr/console/console.C index 8a066fe85..eed9756cd 100644 --- a/src/usr/console/console.C +++ b/src/usr/console/console.C @@ -8,7 +8,6 @@ /* Contributors Listed Below - COPYRIGHT 2014 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ -/* [+] Google Inc. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -107,6 +106,10 @@ namespace CONSOLE msg_t* msg = msg_allocate(); msg->type = SYNC; msg_sendrecv(g_msgq, msg); + + // Always free since send/recv implies ownership + msg_free(msg); + msg=nullptr; } } diff --git a/src/usr/errl/errlmanager.C b/src/usr/errl/errlmanager.C index 24008e7ea..4476640f7 100644 --- a/src/usr/errl/errlmanager.C +++ b/src/usr/errl/errlmanager.C @@ -821,13 +821,17 @@ void ErrlManager::flushErrorLogs() TRACDCOMP( g_trac_errl, ENTER_MRK "ErrlManager::flushErrorLogs" ); // Create message to send to msg handler - msg_t *msg = NULL; + msg_t *msg = nullptr; msg = msg_allocate(); msg->type = ERRLOG_FLUSH_TYPE; do{ // Send message to msg handler, get msg back on l_RecvMsgQ int rc = msg_sendrecv(iv_msgQ,msg); + // Always free the message since send/recv implies ownership + msg_free(msg); + msg=nullptr; + if(rc) { TRACFCOMP(g_trac_errl, "Error sending error log flush message. " diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C index 129068941..5e2c8ddb2 100644 --- a/src/usr/runtime/populate_hbruntime.C +++ b/src/usr/runtime/populate_hbruntime.C @@ -3286,6 +3286,10 @@ errlHndl_t persistent_rwAttrRuntimeCheck( void ) } } + // Always free the message since send/recv implies ownership + msg_free(l_msg); + l_msg=nullptr; + return l_err; } // end persistent_rwAttrRuntimeCheck diff --git a/src/usr/trace/daemonif.C b/src/usr/trace/daemonif.C index f84844800..90e3fbec0 100644 --- a/src/usr/trace/daemonif.C +++ b/src/usr/trace/daemonif.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -40,6 +40,7 @@ namespace TRACE msg->type = TRACE_DAEMON_SHUTDOWN; msg_sendrecv(iv_queue, msg); msg_free(msg); + msg=nullptr; } msg_q_destroy(iv_queue); @@ -58,6 +59,10 @@ namespace TRACE if (i_blocking) { msg_sendrecv(iv_queue, msg); // sync message due to 'blocking'. + + // Always free the message since send/receive implies ownership + msg_free(msg); + msg=nullptr; } else { @@ -76,6 +81,7 @@ namespace TRACE msg->data[0] = i_enable ? 0x2 : 0x0; msg_sendrecv(iv_queue, msg); msg_free(msg); + msg=nullptr; } } |