From: sung.goo.kim Date: Wed, 24 Feb 2016 06:45:12 +0000 (+0900) Subject: Fix invalid memory access X-Git-Tag: submit/tizen/20160226.064209~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F60208%2F1;p=platform%2Fcore%2Fiot%2Fiotcon.git Fix invalid memory access Change-Id: I919a78b40a731a19572a0093c3b635f69221a800 --- diff --git a/lib/icl-resource-interfaces.c b/lib/icl-resource-interfaces.c index 1b2c262..a46721d 100644 --- a/lib/icl-resource-interfaces.c +++ b/lib/icl-resource-interfaces.c @@ -124,6 +124,7 @@ API int iotcon_resource_interfaces_remove(iotcon_resource_interfaces_h ifaces, const char *iface) { GList *node; + char *node_data; RETV_IF(false == ic_utils_check_oic_feature_supported(), IOTCON_ERROR_NOT_SUPPORTED); RETV_IF(NULL == ifaces, IOTCON_ERROR_INVALID_PARAMETER); @@ -137,8 +138,9 @@ API int iotcon_resource_interfaces_remove(iotcon_resource_interfaces_h ifaces, return IOTCON_ERROR_NO_DATA; } + node_data = node->data; ifaces->iface_list = g_list_delete_link(ifaces->iface_list, node); - free(node->data); + free(node_data); return IOTCON_ERROR_NONE; } diff --git a/lib/icl-resource-types.c b/lib/icl-resource-types.c index c288782..0078cde 100644 --- a/lib/icl-resource-types.c +++ b/lib/icl-resource-types.c @@ -128,6 +128,7 @@ API int iotcon_resource_types_add(iotcon_resource_types_h types, const char *typ API int iotcon_resource_types_remove(iotcon_resource_types_h types, const char *type) { GList *found_node; + char *node_data; RETV_IF(false == ic_utils_check_oic_feature_supported(), IOTCON_ERROR_NOT_SUPPORTED); RETV_IF(NULL == types, IOTCON_ERROR_INVALID_PARAMETER); @@ -141,8 +142,9 @@ API int iotcon_resource_types_remove(iotcon_resource_types_h types, const char * return IOTCON_ERROR_NO_DATA; } + node_data = found_node->data; types->type_list = g_list_delete_link(types->type_list, found_node); - free(found_node->data); + free(node_data); return IOTCON_ERROR_NONE; }