From d65964b74291727e8eba2804593c8ab6150f5b01 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 17 Sep 2019 21:51:17 +0900 Subject: [PATCH] default_backend: fix some svace issues Change-Id: I78fe3f4efc5723e93baf6227f9accb5a43d56f1a --- backends/default_backend.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backends/default_backend.c b/backends/default_backend.c index 390bfab..5d71cf2 100644 --- a/backends/default_backend.c +++ b/backends/default_backend.c @@ -24,6 +24,7 @@ */ #include "default_backend.h" +#include pui_backend_ani_func *ani_func = NULL; Eina_Hash *_animations_hash = NULL; @@ -205,15 +206,17 @@ static char * _read_json_file(const char *path, int *data_size) { FILE *fp = fopen(path, "rb"); - unsigned int size; - char *buffer; + int size; + char *buffer = NULL; ERROR_CHECK(fp, return NULL, "Failed to open file: %s\n", path); fseek(fp, 0, SEEK_END); - size = (unsigned int)ftell(fp); + size = (long int)ftell(fp); fseek(fp, 0, SEEK_SET); + ERROR_CHECK(0 < size && size < INT_MAX, goto error, "Invalid file: %d size\n", size); buffer = (char *)calloc(sizeof(char), size + 1); + ERROR_CHECK(buffer, goto error, "Failed to allocate memory for buffer\n"); if (fread(buffer, size, 1, fp) < 1) { goto error; -- 2.7.4