fix memory leak in converting acl step 01/87601/2
authoryoungman <yman.jung@samsung.com>
Thu, 8 Sep 2016 23:41:53 +0000 (08:41 +0900)
committeryoungman <yman.jung@samsung.com>
Thu, 8 Sep 2016 23:43:46 +0000 (08:43 +0900)
Change-Id: Ice695ceb2b5fcff68fb6d34702e7d939aaa9cea0
Signed-off-by: youngman <yman.jung@samsung.com>
src/ic-provisioning.c

index fab9908..f4df214 100644 (file)
@@ -522,6 +522,8 @@ static OicSecAcl_t* _provisioning_convert_acl(iotcon_provisioning_device_h devic
                resource->types = calloc(1, sizeof(char*));
                if (NULL == resource->types) {
                        ERR("calloc() Fail(%d)", errno);
+                       free(resource);
+                       OCDeleteACLList(oic_acl);
                        return NULL;
                }
                resource->types[0] = strdup(" ");
@@ -530,6 +532,10 @@ static OicSecAcl_t* _provisioning_convert_acl(iotcon_provisioning_device_h devic
                resource->interfaces = calloc(1, sizeof(char*));
                if (NULL == resource->interfaces) {
                        ERR("calloc() Fail(%d)", errno);
+                       free(resource->types[0]);
+                       free(resource->types);
+                       free(resource);
+                       OCDeleteACLList(oic_acl);
                        return NULL;
                }
                resource->interfaces[0] = strdup(OC_RSRVD_INTERFACE_DEFAULT);