summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_image.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-09-19 23:43:58 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-09-20 00:20:36 +0100
commit82de87dfc5b4e42e70cc106a324286f1a4fbfe3b (patch)
tree33dede82e0d71da911b53036c657690ed2bc5169 /src/tests/evas/evas_test_image.c
parent485ecc24ed17af59f7581b4d145bd4e6b4b8363a (diff)
evas test - check return of ftell and malloc and handle properly
fix CID 1400871
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r--src/tests/evas/evas_test_image.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index 8106a0869e..4ec5aa919e 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -643,8 +643,18 @@ _file_to_memory(const char *filename, char **result)
643 643
644 fseek(f, 0, SEEK_END); 644 fseek(f, 0, SEEK_END);
645 size = ftell(f); 645 size = ftell(f);
646 if (size <= 0)
647 {
648 fclose(f);
649 return -1;
650 }
646 fseek(f, 0, SEEK_SET); 651 fseek(f, 0, SEEK_SET);
647 *result = (char *)malloc(size + 1); 652 *result = (char *)malloc(size + 1);
653 if (*result == NULL)
654 {
655 fclose(f);
656 return -1;
657 }
648 if ((size_t)size != fread(*result, sizeof(char), size, f)) 658 if ((size_t)size != fread(*result, sizeof(char), size, f))
649 { 659 {
650 free(*result); 660 free(*result);