osaf/services/saf/immsv/immnd/ImmModel.cc | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)
Fix cppcheck incorrectStringBooleanError warnings.
diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc
b/osaf/services/saf/immsv/immnd/ImmModel.cc
--- a/osaf/services/saf/immsv/immnd/ImmModel.cc
+++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
@@ -12865,18 +12865,14 @@ ImmModel::resourceDisplay(const struct I
} else {
LOG_WA("The resource type is not present in the requested
parameters for displaying IMM resources");
err = SA_AIS_ERR_INVALID_PARAM;
- int len= strlen("resource type is not present in the requested
parameters")+1;
- errStr = (SaStringT)malloc (len);
- strcpy(errStr, "resource type is not present in the requested
parameters");
+ errStr = strdup("resource type is not present in the requested
parameters");
goto done;
}
}
} else {
LOG_WA("The Operation name is not present in the requested parameters
for displaying IMM resources");
err = SA_AIS_ERR_INVALID_PARAM;
- int len= strlen("Operation name is not present in the requested
parameters")+1;
- errStr = (SaStringT)malloc (len);
- strcpy(errStr, "Operation name is not present in the requested
parameters");
+ errStr = strdup("Operation name is not present in the requested
parameters");
goto done;
}
@@ -12898,9 +12894,7 @@ ImmModel::resourceDisplay(const struct I
}else {
LOG_WA("Display of IMM reources for resourceName %s is
unsupported", resourceName);
err = SA_AIS_ERR_INVALID_PARAM;
- int cnt = strlen("Display of IMM reources for resourceName is
unsupported")+1;
- errStr = (SaStringT)malloc (cnt);
- strcpy(errStr, "Display of IMM reources for resourceName is
unsupported");
+ errStr = strdup("Display of IMM reources for resourceName is
unsupported")+1;
free(resparams);
resparams = NULL;
goto done;
@@ -12979,9 +12973,7 @@ ImmModel::resourceDisplay(const struct I
} else {
LOG_WA("Verbose display of reourcename %s is unsupported",
resourceName);
err = SA_AIS_ERR_INVALID_PARAM;
- int cnt = strlen("verbose display of requested resourceName is
unsupported")+1;
- errStr = (SaStringT)malloc (cnt);
- strcpy(errStr, "Verbose display of requested resourceName is
unsupported");
+ errStr = strdup("verbose display of requested resourceName is
unsupported");
goto done;
}
} else if((strcmp(opName,"display-help")==0)) {
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel