aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudarsana Nagineni <sudarsana.nagineni@intel.com>2016-08-29 10:11:55 +0300
committerGabriel Schulhof <gabriel.schulhof@intel.com>2016-08-29 13:40:49 +0000
commit486fa2601bb95185f47429b3c48f0730fb7e3325 (patch)
treefa0a44ac6f8ade8dc812866807a8b85727ad4574
parentd3f00f51ba73d0e2ae58d951fbe1493ac6bcebd2 (diff)
Bindings: Fix memory leaks in OCSetDeviceInfo and platformInfo
Fix leaks in OCSetDeviceInfo by freeing all the members of OCDeviceInfo. Fix a leak in platformInfo by removing duplicate assignment of platformID. Closes gh-71 Closes gh-72 Change-Id: If4fb7da8b2ecf36ef6c0348067b5719ae849cce2 Signed-off-by: Sudarsana Nagineni <sudarsana.nagineni@intel.com> Reviewed-on: https://gerrit.iotivity.org/gerrit/11067 Reviewed-by: Gabriel Schulhof <gabriel.schulhof@intel.com> Tested-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
-rw-r--r--src/functions/simple.cc2
-rw-r--r--src/structures/oc-platform-info.cc2
2 files changed, 1 insertions, 3 deletions
diff --git a/src/functions/simple.cc b/src/functions/simple.cc
index b096bad..5cf8dad 100644
--- a/src/functions/simple.cc
+++ b/src/functions/simple.cc
@@ -66,7 +66,7 @@ NAN_METHOD(bind_OCSetDeviceInfo) {
OCStackResult result = OCSetDeviceInfo(deviceInfo);
- free(deviceInfo.deviceName);
+ c_OCDeviceInfoFreeMembers(&deviceInfo);
info.GetReturnValue().Set(Nan::New(result));
}
diff --git a/src/structures/oc-platform-info.cc b/src/structures/oc-platform-info.cc
index 0cad470..368ee62 100644
--- a/src/structures/oc-platform-info.cc
+++ b/src/structures/oc-platform-info.cc
@@ -62,8 +62,6 @@ bool c_OCPlatformInfo(Local<Object> platformInfo, OCPlatformInfo *info) {
VALIDATE_AND_ASSIGN_STRING(&local, platformID, platformInfo,
c_OCPlatformInfoFreeMembers, false);
- VALIDATE_AND_ASSIGN_STRING(&local, platformID, platformInfo,
- c_OCPlatformInfoFreeMembers, false);
VALIDATE_AND_ASSIGN_STRING(&local, manufacturerName, platformInfo,
c_OCPlatformInfoFreeMembers, false);
VALIDATE_AND_ASSIGN_STRING(&local, manufacturerUrl, platformInfo,