summaryrefslogtreecommitdiff
path: root/src/lib/emile
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-25 19:27:20 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-25 19:27:20 +0200
commit888057f0bc4a4af91d91e05f15197cce169fbcfc (patch)
treedc1f6474ab07364ee39354f31779d0afd7607e1e /src/lib/emile
parent5d59a403cd4797af8e084a7a32313dd9c51389bd (diff)
emile: fix memory leak.
CID 1288924 & 1288923
Diffstat (limited to 'src/lib/emile')
-rw-r--r--src/lib/emile/emile_image.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/emile/emile_image.c b/src/lib/emile/emile_image.c
index c5eb1f3461..06a5da4e88 100644
--- a/src/lib/emile/emile_image.c
+++ b/src/lib/emile/emile_image.c
@@ -1599,6 +1599,9 @@ _emile_jpeg_data(Emile_Image *image,
1599 volatile int degree = 0; 1599 volatile int degree = 0;
1600 volatile Eina_Bool change_wh = EINA_FALSE; 1600 volatile Eina_Bool change_wh = EINA_FALSE;
1601 Eina_Bool line_done = EINA_FALSE; 1601 Eina_Bool line_done = EINA_FALSE;
1602 Eina_Bool ptrg_free = EINA_FALSE;
1603 Eina_Bool ptrag_free = EINA_FALSE;
1604 Eina_Bool r = EINA_FALSE;
1602 unsigned int length; 1605 unsigned int length;
1603 1606
1604 if (sizeof(Emile_Image_Property) != property_size) 1607 if (sizeof(Emile_Image_Property) != property_size)
@@ -1781,11 +1784,13 @@ _emile_jpeg_data(Emile_Image *image,
1781 { 1784 {
1782 ptrg = malloc(w * h * sizeof(uint8_t)); 1785 ptrg = malloc(w * h * sizeof(uint8_t));
1783 ptrg_rotate = ptrg; 1786 ptrg_rotate = ptrg;
1787 ptrg_free = EINA_TRUE;
1784 } 1788 }
1785 else if (prop->cspace == EMILE_COLORSPACE_AGRY88) 1789 else if (prop->cspace == EMILE_COLORSPACE_AGRY88)
1786 { 1790 {
1787 ptrag = malloc(w * h * sizeof(uint16_t)); 1791 ptrag = malloc(w * h * sizeof(uint16_t));
1788 ptrag_rotate = ptrag; 1792 ptrag_rotate = ptrag;
1793 ptrag_free = EINA_TRUE;
1789 } 1794 }
1790 else 1795 else
1791 { 1796 {
@@ -2216,15 +2221,17 @@ done:
2216 } 2221 }
2217 /* end data decoding */ 2222 /* end data decoding */
2218 jpeg_finish_decompress(&cinfo); 2223 jpeg_finish_decompress(&cinfo);
2219 jpeg_destroy_decompress(&cinfo);
2220 _emile_jpeg_membuf_src_term(&cinfo);
2221 *error = EMILE_IMAGE_LOAD_ERROR_NONE; 2224 *error = EMILE_IMAGE_LOAD_ERROR_NONE;
2222 return EINA_TRUE; 2225 r = EINA_TRUE;
2226
2227 on_error:
2228 if (ptrg_free) free(ptrg);
2229 if (ptrag_free) free(ptrag);
2223 2230
2224on_error:
2225 jpeg_destroy_decompress(&cinfo); 2231 jpeg_destroy_decompress(&cinfo);
2226 _emile_jpeg_membuf_src_term(&cinfo); 2232 _emile_jpeg_membuf_src_term(&cinfo);
2227 return EINA_FALSE; 2233 return r;
2234
2228} 2235}
2229 2236
2230static void 2237static void