fix some svase issues 08/220708/1
authorjeon <jhyuni.kang@samsung.com>
Tue, 17 Sep 2019 11:35:01 +0000 (20:35 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 20 Dec 2019 09:55:56 +0000 (18:55 +0900)
Change-Id: Ib0f336698622a407f32539b27584526e6e602284

backends/default_backend.c
src/PUI.c

index ddd4463..390bfab 100644 (file)
@@ -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++) {
index 2da36b2..9eab3e0 100644 (file)
--- 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)