Add null check of out parameter
authorsung.goo.kim <sung.goo.kim@samsung.com>
Wed, 16 Dec 2015 01:46:34 +0000 (10:46 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 16 Dec 2015 07:40:27 +0000 (16:40 +0900)
Change-Id: I05edac331dc233dd2614ded9d30ae399598113f3

lib/icl-list.c
lib/icl-representation.c
lib/icl-resource-types.c
lib/icl-state.c

index 0ece1f59d48cbde236a0d4fd12b066f04ae3f1a6..f65636786c9f31e650564ef66867fd37db46904e 100644 (file)
@@ -420,6 +420,7 @@ API int iotcon_list_get_type(iotcon_list_h list, iotcon_type_e *type)
 API int iotcon_list_get_length(iotcon_list_h list, unsigned int *length)
 {
        RETV_IF(NULL == list, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == length, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == list->list, IOTCON_ERROR_INVALID_PARAMETER);
 
        *length = g_list_length(list->list);
index a8acb9f4e2b12a9d85e67228d67f01a911d44a2b..e5f177eb82663d2b0db768f287f88d8b308658cb 100644 (file)
@@ -155,6 +155,7 @@ API int iotcon_representation_get_resource_interfaces(iotcon_representation_h re
                int *ifaces)
 {
        RETV_IF(NULL == repr, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ifaces, IOTCON_ERROR_INVALID_PARAMETER);
 
        *ifaces = repr->interfaces;
 
@@ -255,6 +256,7 @@ API int iotcon_representation_get_children_count(iotcon_representation_h parent,
                unsigned int *count)
 {
        RETV_IF(NULL == parent, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == count, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == parent->children, IOTCON_ERROR_INVALID_PARAMETER);
 
        *count = g_list_length(parent->children);
@@ -299,6 +301,7 @@ API int iotcon_state_foreach(iotcon_state_h state, iotcon_state_cb cb, void *use
 API int iotcon_state_get_keys_count(iotcon_state_h state, unsigned int *count)
 {
        RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == count, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == state->hash_table, IOTCON_ERROR_INVALID_PARAMETER);
 
        *count = g_hash_table_size(state->hash_table);
@@ -387,6 +390,7 @@ API int iotcon_representation_clone(const iotcon_representation_h src,
        iotcon_representation_h cloned_repr, copied_repr;
 
        RETV_IF(NULL == src, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dest, IOTCON_ERROR_INVALID_PARAMETER);
 
        ret = iotcon_representation_create(&cloned_repr);
        if (IOTCON_ERROR_NONE != ret) {
index e78306ba14f4a0007e6a19b9c725b35a20f88396..6bc08f0baa4c1ff8a159d5fd2fb94e3692159f27 100644 (file)
@@ -170,6 +170,7 @@ API int iotcon_resource_types_clone(iotcon_resource_types_h src,
        iotcon_resource_types_h resource_types;
 
        RETV_IF(NULL == src, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dest, IOTCON_ERROR_INVALID_PARAMETER);
 
        resource_types = calloc(1, sizeof(struct icl_resource_types));
        if (NULL == resource_types) {
index 3c7199332e0c61e6f633291dbbe8759863e9df1d..6fafe97df5bcf2836f864ce8287cd4b79b69f53b 100644 (file)
@@ -316,6 +316,7 @@ API int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_nul
 
        RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == is_null, IOTCON_ERROR_INVALID_PARAMETER);
 
        value = (iotcon_value_h) g_hash_table_lookup(state->hash_table, key);
        if (NULL == value) {