WsmanFilter: replace malloc with new in C++ code
The new operator is more suitable to C++ code and
will throw exception if failed to allocate memory,
instead of returning NULL-pointer.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
diff --git a/src/cpp/WsmanFilter.cpp b/src/cpp/WsmanFilter.cpp
index c904242..8000863 100644
--- a/src/cpp/WsmanFilter.cpp
+++ b/src/cpp/WsmanFilter.cpp
@@ -51,7 +51,7 @@
char **props = NULL;
if (!resultProp.empty()) {
- props = static_cast<char**>(malloc(sizeof(char *) * resultProp.size()));
+ props = new char* [resultProp.size()];
vector<string>::const_iterator itr;
for (itr = resultProp.begin(); itr != resultProp.end(); itr++, i++) {
props[i] = const_cast<char*>(itr->c_str());
@@ -67,7 +67,7 @@
(resultRole.empty() ? NULL : resultRole.c_str()),
props, i);
- free(props);
+ delete [] props;
}
WsmanFilter::~WsmanFilter()