summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@free.fr>2014-04-17 21:18:32 +0200
committerCedric Bail <cedric.bail@free.fr>2014-04-17 21:18:32 +0200
commit82b2c8df9e8adecc61b6ea95cf45f88e7e3bf79c (patch)
tree261e4051f37c8475376133486a7776d971feab36
parent2401bb047d5620a217252a9c78be4ef307290497 (diff)
evas: fix TGV loader to not leak ressource.
CID 1195443.
-rw-r--r--src/modules/evas/loaders/tgv/evas_image_load_tgv.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/modules/evas/loaders/tgv/evas_image_load_tgv.c b/src/modules/evas/loaders/tgv/evas_image_load_tgv.c
index 49bbfc3..e8119a7 100644
--- a/src/modules/evas/loaders/tgv/evas_image_load_tgv.c
+++ b/src/modules/evas/loaders/tgv/evas_image_load_tgv.c
@@ -74,16 +74,16 @@ evas_image_load_file_open_tgv(Eina_File *f, Eina_Stringshare *key EINA_UNUSED,
74{ 74{
75 Evas_Loader_Internal *loader; 75 Evas_Loader_Internal *loader;
76 76
77 loader = calloc(1, sizeof (Evas_Loader_Internal)); 77 if (eina_file_size_get(f) <= 16)
78 if (!loader)
79 { 78 {
80 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; 79 *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
81 return NULL; 80 return NULL;
82 } 81 }
83 82
84 if (eina_file_size_get(f) <= 16) 83 loader = calloc(1, sizeof (Evas_Loader_Internal));
84 if (!loader)
85 { 85 {
86 *error = EVAS_LOAD_ERROR_CORRUPT_FILE; 86 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
87 return NULL; 87 return NULL;
88 } 88 }
89 89
@@ -91,6 +91,7 @@ evas_image_load_file_open_tgv(Eina_File *f, Eina_Stringshare *key EINA_UNUSED,
91 if (!loader->f) 91 if (!loader->f)
92 { 92 {
93 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; 93 *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
94 free(loader);
94 return NULL; 95 return NULL;
95 } 96 }
96 97