From efc32b87977a6ec07ab8239de9bff61d50bd1652 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 5 Nov 2018 09:45:15 +0900 Subject: [PATCH] Initialize NULL after dealloc memory Change-Id: I57ecd4257469fe321b1cd3e14d441c683ebfe086 Signed-off-by: Jihoon Kim --- common/autofill_auth_info.c | 16 ++++++++++++---- common/autofill_fill_response.c | 4 +++- common/autofill_fill_response_item.c | 12 +++++++++--- common/autofill_item.c | 12 +++++++++--- common/autofill_save_item.c | 12 +++++++++--- common/autofill_save_view_info.c | 8 ++++++-- common/autofill_view_info.c | 8 ++++++-- include/autofill_common.h | 0 include/autofill_service.h | 0 9 files changed, 54 insertions(+), 18 deletions(-) mode change 100755 => 100644 common/autofill_fill_response_item.c mode change 100755 => 100644 common/autofill_save_item.c mode change 100755 => 100644 common/autofill_save_view_info.c mode change 100755 => 100644 common/autofill_view_info.c mode change 100755 => 100644 include/autofill_common.h mode change 100755 => 100644 include/autofill_service.h diff --git a/common/autofill_auth_info.c b/common/autofill_auth_info.c index 80ae5eb..ccb8cc1 100644 --- a/common/autofill_auth_info.c +++ b/common/autofill_auth_info.c @@ -58,17 +58,25 @@ EXPORT_API int autofill_auth_info_destroy(autofill_auth_info_h ai) if (!ai) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (ai->app_id) + if (ai->app_id) { free(ai->app_id); + ai->app_id = NULL; + } - if (ai->service_name) + if (ai->service_name) { free(ai->service_name); + ai->service_name = NULL; + } - if (ai->service_message) + if (ai->service_message) { free(ai->service_message); + ai->service_message = NULL; + } - if (ai->service_logo_image_path) + if (ai->service_logo_image_path) { free(ai->service_logo_image_path); + ai->service_logo_image_path = NULL; + } free(ai); diff --git a/common/autofill_fill_response.c b/common/autofill_fill_response.c index ba2e626..8116897 100644 --- a/common/autofill_fill_response.c +++ b/common/autofill_fill_response.c @@ -46,8 +46,10 @@ EXPORT_API int autofill_fill_response_destroy(autofill_fill_response_h h) if (!h) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (h->view_id) + if (h->view_id) { free(h->view_id); + h->view_id = NULL; + } // Release memory autofill fill response item list autofill_fill_response_group_h it_h; diff --git a/common/autofill_fill_response_item.c b/common/autofill_fill_response_item.c old mode 100755 new mode 100644 index 604717a..52d8af8 --- a/common/autofill_fill_response_item.c +++ b/common/autofill_fill_response_item.c @@ -52,14 +52,20 @@ EXPORT_API int autofill_fill_response_item_destroy(autofill_fill_response_item_h if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (it->id) + if (it->id) { free(it->id); + it->id = NULL; + } - if (it->value) + if (it->value) { free(it->value); + it->value = NULL; + } - if (it->presentation_text) + if (it->presentation_text) { free(it->presentation_text); + it->presentation_text = NULL; + } free(it); diff --git a/common/autofill_item.c b/common/autofill_item.c index e43c3ae..450443a 100644 --- a/common/autofill_item.c +++ b/common/autofill_item.c @@ -57,14 +57,20 @@ EXPORT_API int autofill_item_destroy(autofill_item_h it) if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (it->id) + if (it->id) { free(it->id); + it->id = NULL; + } - if (it->label) + if (it->label) { free(it->label); + it->label = NULL; + } - if (it->value) + if (it->value) { free(it->value); + it->value = NULL; + } free(it); diff --git a/common/autofill_save_item.c b/common/autofill_save_item.c old mode 100755 new mode 100644 index 381421a..a0404d3 --- a/common/autofill_save_item.c +++ b/common/autofill_save_item.c @@ -56,14 +56,20 @@ EXPORT_API int autofill_save_item_destroy(autofill_save_item_h it) if (!it) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (it->id) + if (it->id) { free(it->id); + it->id = NULL; + } - if (it->label) + if (it->label) { free(it->label); + it->label = NULL; + } - if (it->value) + if (it->value) { free(it->value); + it->value = NULL; + } free(it); diff --git a/common/autofill_save_view_info.c b/common/autofill_save_view_info.c old mode 100755 new mode 100644 index 4be0ff9..90c92cb --- a/common/autofill_save_view_info.c +++ b/common/autofill_save_view_info.c @@ -47,11 +47,15 @@ EXPORT_API int autofill_save_view_info_destroy(autofill_save_view_info_h vi) if (!vi) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->app_id) + if (vi->app_id) { free(vi->app_id); + vi->app_id = NULL; + } - if (vi->view_id) + if (vi->view_id) { free(vi->view_id); + vi->view_id = NULL; + } // release memory autofill item list autofill_save_item_h it_h; diff --git a/common/autofill_view_info.c b/common/autofill_view_info.c old mode 100755 new mode 100644 index cbb1e55..864d5b6 --- a/common/autofill_view_info.c +++ b/common/autofill_view_info.c @@ -46,11 +46,15 @@ EXPORT_API int autofill_view_info_destroy(autofill_view_info_h vi) if (!vi) return AUTOFILL_ERROR_INVALID_PARAMETER; - if (vi->app_id) + if (vi->app_id) { free(vi->app_id); + vi->app_id = NULL; + } - if (vi->view_id) + if (vi->view_id) { free(vi->view_id); + vi->view_id = NULL; + } // release memory autofill item list autofill_item_h it_h; diff --git a/include/autofill_common.h b/include/autofill_common.h old mode 100755 new mode 100644 diff --git a/include/autofill_service.h b/include/autofill_service.h old mode 100755 new mode 100644 -- 2.7.4