Ack, code review only.
Thanks,
Praveen
On 13-Jun-16 1:01 PM, Hoang Vo wrote:
> osaf/libs/agents/saf/ntfa/ntfa_api.c | 26
> ++++++++++++--------------
> osaf/services/saf/ntfsv/ntfimcnd/ntfimcn_imm.c | 13 ++++---------
> osaf/services/saf/ntfsv/ntfs/ntfs_main.c | 4 +---
> 3 files changed, 17 insertions(+), 26 deletions(-)
>
>
> This enhancement fix following warning results from cppcheck 1.74:
> Either the condition is redundant or there is possible null pointer
> dereference
>
> This enhancement does not fix following warnings when they are not problems:
> Style and performance warnings
>
> diff --git a/osaf/libs/agents/saf/ntfa/ntfa_api.c
> b/osaf/libs/agents/saf/ntfa/ntfa_api.c
> --- a/osaf/libs/agents/saf/ntfa/ntfa_api.c
> +++ b/osaf/libs/agents/saf/ntfa/ntfa_api.c
> @@ -2086,7 +2086,7 @@ SaAisErrorT saNtfNotificationSubscribe(c
> goto done;
>
> /* recovery */
> - if (client_hdl_rec != NULL && !client_hdl_rec->valid) {
> + if (!client_hdl_rec->valid) {
> if ((rc = recoverClient(client_hdl_rec)) != SA_AIS_OK) {
> recovery_failed = true;
> goto done;
> @@ -3442,7 +3442,7 @@ SaAisErrorT saNtfNotificationReadInitial
> goto done_give_client_hdl;
>
> /* recovery */
> - if (client_hdl_rec != NULL && !client_hdl_rec->valid) {
> + if (!client_hdl_rec->valid) {
> if ((rc = recoverClient(client_hdl_rec)) != SA_AIS_OK) {
> recovery_failed = true;
> goto done_give_client_hdl;
> @@ -3511,18 +3511,16 @@ done_give_client_hdl:
>
> if (client_hdl_rec)
> ncshm_give_hdl(client_hdl_rec->local_hdl);
> - if (notificationFilterHandles) {
> - if (notificationFilterHandles->attributeChangeFilterHandle)
> -
> ncshm_give_hdl(notificationFilterHandles->attributeChangeFilterHandle);
> - if (notificationFilterHandles->objectCreateDeleteFilterHandle)
> -
> ncshm_give_hdl(notificationFilterHandles->objectCreateDeleteFilterHandle);
> - if (notificationFilterHandles->securityAlarmFilterHandle)
> -
> ncshm_give_hdl(notificationFilterHandles->securityAlarmFilterHandle);
> - if (notificationFilterHandles->stateChangeFilterHandle)
> -
> ncshm_give_hdl(notificationFilterHandles->stateChangeFilterHandle);
> - if (notificationFilterHandles->alarmFilterHandle)
> -
> ncshm_give_hdl(notificationFilterHandles->alarmFilterHandle);
> - }
> + if (notificationFilterHandles->attributeChangeFilterHandle)
> +
> ncshm_give_hdl(notificationFilterHandles->attributeChangeFilterHandle);
> + if (notificationFilterHandles->objectCreateDeleteFilterHandle)
> +
> ncshm_give_hdl(notificationFilterHandles->objectCreateDeleteFilterHandle);
> + if (notificationFilterHandles->securityAlarmFilterHandle)
> +
> ncshm_give_hdl(notificationFilterHandles->securityAlarmFilterHandle);
> + if (notificationFilterHandles->stateChangeFilterHandle)
> +
> ncshm_give_hdl(notificationFilterHandles->stateChangeFilterHandle);
> + if (notificationFilterHandles->alarmFilterHandle)
> + ncshm_give_hdl(notificationFilterHandles->alarmFilterHandle);
>
> ncshm_give_hdl(notificationFilterHandles->alarmFilterHandle);
> if (recovery_failed && (rc == SA_AIS_ERR_BAD_HANDLE)) {
> diff --git a/osaf/services/saf/ntfsv/ntfimcnd/ntfimcn_imm.c
> b/osaf/services/saf/ntfsv/ntfimcnd/ntfimcn_imm.c
> --- a/osaf/services/saf/ntfsv/ntfimcnd/ntfimcn_imm.c
> +++ b/osaf/services/saf/ntfsv/ntfimcnd/ntfimcn_imm.c
> @@ -371,9 +371,8 @@ static SaAisErrorT saImmOiCcbObjectDelet
> goto done;
> }
>
> - if (ccbUtilCcbData != NULL) {
> - ccbutil_deleteCcbData(ccbUtilCcbData);
> - }
> +
> + ccbutil_deleteCcbData(ccbUtilCcbData);
>
> if (internal_rc != 0) {
> LOG_ER("%s send_object_create_notification fail",
> @@ -452,9 +451,7 @@ static SaAisErrorT saImmOiCcbObjectCreat
> ccbUtilOperationData, rdn_attr_name,
> SA_FALSE);
>
> - if (ccbUtilCcbData != NULL) {
> - ccbutil_deleteCcbData(ccbUtilCcbData);
> - }
> + ccbutil_deleteCcbData(ccbUtilCcbData);
>
> if (internal_rc != 0) {
> LOG_ER("%s send_object_create_notification fail",
> @@ -519,9 +516,7 @@ static SaAisErrorT saImmOiCcbObjectModif
> invoker_name_ptr,
> SA_FALSE);
>
> - if (ccbUtilCcbData != NULL) {
> - ccbutil_deleteCcbData(ccbUtilCcbData);
> - }
> + ccbutil_deleteCcbData(ccbUtilCcbData);
>
> if (internal_rc != 0) {
> LOG_ER("%s send_object_modify_notification fail",
> diff --git a/osaf/services/saf/ntfsv/ntfs/ntfs_main.c
> b/osaf/services/saf/ntfsv/ntfs/ntfs_main.c
> --- a/osaf/services/saf/ntfsv/ntfs/ntfs_main.c
> +++ b/osaf/services/saf/ntfsv/ntfs/ntfs_main.c
> @@ -119,9 +119,7 @@ static void rda_cb(uint32_t cb_hdl, PCS_
> rc = ncs_ipc_send(&ntfs_cb->mbx, (NCS_IPC_MSG *)evt,
> MDS_SEND_PRIORITY_VERY_HIGH);
> if (rc != NCSCC_RC_SUCCESS) {
> LOG_ER("IPC send failed %d", rc);
> - if (evt != NULL) {
> - free(evt);
> - }
> + free(evt);
> }
>
> done:
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel