From: jeon Date: Tue, 17 Sep 2019 11:35:01 +0000 (+0900) Subject: fix some svase issues X-Git-Tag: accepted/tizen/5.5/unified/20200102.014046~12 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibpui.git;a=commitdiff_plain;h=900740af7b801a9413d092eae9fbf2ed806a3039 fix some svase issues Change-Id: Ib0f336698622a407f32539b27584526e6e602284 --- diff --git a/backends/default_backend.c b/backends/default_backend.c index ddd4463..390bfab 100644 --- a/backends/default_backend.c +++ b/backends/default_backend.c @@ -205,26 +205,29 @@ static char * _read_json_file(const char *path, int *data_size) { FILE *fp = fopen(path, "rb"); - int size; + unsigned int size; char *buffer; ERROR_CHECK(fp, return NULL, "Failed to open file: %s\n", path); fseek(fp, 0, SEEK_END); - size = ftell(fp); + size = (unsigned int)ftell(fp); fseek(fp, 0, SEEK_SET); buffer = (char *)calloc(sizeof(char), size + 1); if (fread(buffer, size, 1, fp) < 1) { - *data_size = 0; - free(buffer); - fclose(fp); - return NULL; + goto error; } *data_size = size; fclose(fp); return buffer; + +error: + *data_size = 0; + if (buffer) free(buffer); + fclose(fp); + return NULL; } static default_ani_info * @@ -237,7 +240,7 @@ _read_json(const char *path) int data_size = 0, i, j; buffer = _read_json_file(path, &data_size); - ERROR_CHECK(buffer && data_size > 0, return EINA_FALSE, "File %s has no data\n", path); + ERROR_CHECK(buffer && data_size > 0, goto error, "File %s has no data\n", path); root_obj = json_tokener_parse(buffer); ERROR_CHECK(root_obj, goto error, "Failed to tokenize json object\n"); @@ -298,7 +301,7 @@ _read_json(const char *path) return ani_info; error: - free(buffer); + if (buffer) free(buffer); if (ani_info) { if (ani_info->frames) { for (i = 0; i < ani_info->num_key_frames; i++) { diff --git a/src/PUI.c b/src/PUI.c index 2da36b2..9eab3e0 100644 --- a/src/PUI.c +++ b/src/PUI.c @@ -369,7 +369,6 @@ pui_destroy(pui_h handle) EINA_LIST_FREE(handle->ani_handles, ani_h) { pui_ani_destroy(ani_h); - free(ani_h); } if (handle->tbm_queue) @@ -454,7 +453,7 @@ _pui_load_backend_module(void) return; err: - if (backend_module_info && backend_module_info->backend_init) + if (backend_module_info && backend_module_info->backend_deinit) backend_module_info->backend_deinit(backend_module_data); if (module_info)