}
if (IC_STR_EQUAL != strcmp(IC_STR_NULL, resource_type))
- snprintf(uri + len, sizeof(uri), "?rt=%s", resource_type);
+ snprintf(uri + len, sizeof(uri) - len, "?rt=%s", resource_type);
context = calloc(1, sizeof(icd_sig_ctx_s));
if (NULL == context) {
DBG("query exist. key(%s), value(%s)", key, value);
if (true == loop_first) {
- query_len = snprintf(uri_buf + len, sizeof(uri_buf), "?%s=%s", key, value);
+ query_len = snprintf(uri_buf + len, sizeof(uri_buf) - len, "?%s=%s", key, value);
loop_first = false;
} else {
- query_len = snprintf(uri_buf + len, sizeof(uri_buf), "&%s=%s", key, value);
+ query_len = snprintf(uri_buf + len, sizeof(uri_buf) - len, "&%s=%s", key, value);
}
len += query_len;
GVariantIter *options;
OCCallbackData cbdata = {0};
int conn_type, options_size;
- char *uri_path, *host, *uri, *dev_host, *ptr;
+ char *uri_path, *host, *uri, *dev_host, *ptr = NULL;
OCHeaderOption oic_options[MAX_HEADER_OPTIONS];
OCHeaderOption *oic_options_ptr = NULL;
OCPayload *payload = NULL;
default:
ERR("Invalid Connectivitiy Type");
icd_ioty_complete_error(type, invocation, IOTCON_ERROR_IOTIVITY);
+ free(uri);
return TRUE;
}
icd_sig_ctx_s *context;
OCCallbackData cbdata = {0};
int conn_type, options_size;
- char *uri_path, *host, *uri, *dev_host, *ptr;
+ char *uri_path, *host, *uri, *dev_host, *ptr = NULL;
OCHeaderOption oic_options[MAX_HEADER_OPTIONS];
OCHeaderOption *oic_options_ptr = NULL;
OCConnectivityType oic_conn_type;
break;
default:
ERR("Invalid Connectivitiy Type");
+ free(context->bus_name);
+ free(context);
+ free(uri);
return NULL;
}
}
if (IC_STR_EQUAL != strcmp(IC_STR_NULL, resource_type))
- snprintf(uri + len, sizeof(uri), "?rt=%s", resource_type);
+ snprintf(uri + len, sizeof(uri) - len, "?rt=%s", resource_type);
context = calloc(1, sizeof(icd_sig_ctx_s));
if (NULL == context) {
gpointer user_data)
{
char *uri_path;
- iotcon_platform_info_s *info = calloc(1, sizeof(iotcon_platform_info_s));
+ iotcon_platform_info_s *info = NULL;
icl_platform_info_s *cb_container = user_data;
iotcon_platform_info_cb cb = cb_container->cb;
+ info = calloc(1, sizeof(iotcon_platform_info_s));
+ if (NULL == info) {
+ ERR("calloc(client) Fail(%d)", errno);
+ return;
+ }
+
g_variant_get(parameters, "(&s&s&s&s&s&s&s&s&s&s&s&s)",
&uri_path,
&info->platform_id,
if (cb)
cb(info, cb_container->user_data);
+
+ free(info);
}
ret = iotcon_state_create(&state);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_state_create() Fail(%d)", ret);
+ iotcon_representation_destroy(repr);
return NULL;
}
ret = iotcon_representation_set_state(repr, state);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_representation_set_state() Fail(%d)", ret);
+ iotcon_state_destroy(state);
+ iotcon_representation_destroy(repr);
return NULL;
}
ERR("iotcon_resource_types_create() Fail(%d)", ret);
g_variant_iter_free(resource_types);
g_variant_iter_free(children);
+ iotcon_state_destroy(state);
+ iotcon_representation_destroy(repr);
return NULL;
}
}
g_variant_iter_free(children);
+ iotcon_state_destroy(state);
+
return repr;
}
ERR("iotcon_query_create() Fail(%d)", ret);
g_variant_iter_free(query);
g_variant_iter_free(repr_iter);
+ if (request.header_options)
+ iotcon_options_destroy(request.header_options);
return;
}
ret = iotcon_state_create(&send_state);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_state_create() Fail(%d)", ret);
+ iotcon_representation_destroy(send_repr);
return;
}
/* send PUT request */
iotcon_put(resource, send_repr, NULL, _on_put, NULL);
+ iotcon_state_destroy(send_state);
iotcon_representation_destroy(send_repr);
}
* limitations under the License.
*/
+#include <stdlib.h>
#include <glib.h>
#include <iotcon.h>
#include "test.h"
char *device_name;
iotcon_platform_info_s *platform_info = calloc(1, sizeof(iotcon_platform_info_s));
+ if (NULL == platform_info) {
+ ERR("calloc() Fail(%d)", errno);
+ return -1;
+ }
platform_info->platform_id = "platform_id";
platform_info->manuf_name = "manuf_name";
ret = iotcon_register_platform_info(platform_info);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_register_platform_info() Fail(%d)", ret);
+ free(platform_info);
return -1;
}
+ free(platform_info);
+
ret = iotcon_register_device_info(device_name);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_register_platform_info() Fail(%d)", ret);
ret = iotcon_list_create(IOTCON_TYPE_INT, &temperature_list);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_list_create() Fail(%d)", ret);
+ iotcon_state_destroy(room_state);
+ iotcon_representation_destroy(room_repr);
return;
}