Made memory allocated at runtime to NULL explicetly. 26/185726/1
authorsaerome.kim <saerome.kim@samsung.com>
Thu, 2 Aug 2018 01:02:55 +0000 (10:02 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 2 Aug 2018 01:02:55 +0000 (10:02 +0900)
Change-Id: I42bff55ef4cb677f85b849c623521e08c66fbf6a
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
src/zbl-zcl.c

index 6322a984d9b2c4955bfbbed5c16db728bab170d4..3c0f845c2a2fcfd300a68fe8d76883b4990bd690 100644 (file)
@@ -84,9 +84,12 @@ API int zb_read_attr_status_record_destroy(
        CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
 
-       if (h->value)
+       if (h->value) {
                free(h->value);
+               h->value = NULL;
+       }
        free(h);
+       h = NULL;
 
        return ZIGBEE_ERROR_NONE;
 }
@@ -298,6 +301,7 @@ API int zb_discover_attr_info_destroy(zb_zcl_discover_attr_info_record_h handle)
        RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
 
        free(h);
+       h = NULL;
 
        return ZIGBEE_ERROR_NONE;
 }
@@ -637,9 +641,12 @@ API int zb_report_config_record_destroy(zb_zcl_reporting_config_record_h handle)
        CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
 
-       if (h->change)
+       if (h->change) {
                free(h->change);
+               h->change = NULL;
+       }
        free(h);
+       h = NULL;
 
        return ZIGBEE_ERROR_NONE;
 }
@@ -886,6 +893,7 @@ API int zb_read_report_config_record_destroy(
        RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
 
        free(h);
+       h = NULL;
 
        return ZIGBEE_ERROR_NONE;
 }
@@ -984,6 +992,7 @@ API int zb_report_config_response_record_destroy(
        RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
 
        free(h);
+       h = NULL;
 
        return ZIGBEE_ERROR_NONE;
 }
@@ -1113,9 +1122,12 @@ API int zb_attr_report_destroy(zb_zcl_attr_report_h handle)
        CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
 
-       if (h->value)
+       if (h->value) {
                free(h->value);
+               h->value = NULL;
+       }
        free(h);
+       h = NULL;
 
        return ZIGBEE_ERROR_NONE;
 }
@@ -1359,6 +1371,7 @@ API int zb_extended_attr_info_destroy(zb_zcl_extended_attr_info_h handle)
        RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
 
        free(h);
+       h = NULL;
 
        return ZIGBEE_ERROR_NONE;
 }