src/amf/amfd/ntf.cc |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


Problem:
Coverity check reported some RESOURCE_LEAK issues on amfd service.
  - Variable job going out of scope leaks the storage it points to.

Fix:
Delete the variable before exiting the function.

diff --git a/src/amf/amfd/ntf.cc b/src/amf/amfd/ntf.cc
--- a/src/amf/amfd/ntf.cc
+++ b/src/amf/amfd/ntf.cc
@@ -630,6 +630,7 @@ uint32_t sendAlarmNotificationAvd(AVD_CL
 
        if (status != SA_AIS_OK) {
                LOG_ER("%s: saNtfAlarmNotificationAllocate Failed (%u)", 
__FUNCTION__, status);
+               delete job;
                return NCSCC_RC_FAILURE;
        }
 
@@ -647,6 +648,7 @@ uint32_t sendAlarmNotificationAvd(AVD_CL
        if (status != SA_AIS_OK) {
                LOG_ER("%s: fill_ntf_header_part_avd Failed (%u)", 
__FUNCTION__, status);
                
saNtfNotificationFree(job->myntf.notification.alarmNotification.notificationHandle);
+               delete job;
                return NCSCC_RC_FAILURE;
        }
 
@@ -718,6 +720,7 @@ uint32_t sendStateChangeNotificationAvd(
 
        if (status != SA_AIS_OK) {
                LOG_ER("%s: saNtfStateChangeNotificationAllocate Failed (%u)", 
__FUNCTION__, status);
+               delete job;
                return NCSCC_RC_FAILURE;
        }
 
@@ -735,6 +738,7 @@ uint32_t sendStateChangeNotificationAvd(
        if (status != SA_AIS_OK) {
                LOG_ER("%s: fill_ntf_header_part_avd Failed (%u)", 
__FUNCTION__, status);
                
saNtfNotificationFree(job->myntf.notification.stateChangeNotification.notificationHandle);
+               delete job;
                return NCSCC_RC_FAILURE;
        }
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to