emile: fix memory leak.
authorCedric BAIL <cedric@osg.samsung.com>
Sat, 25 Apr 2015 18:00:44 +0000 (20:00 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Sat, 25 Apr 2015 18:00:44 +0000 (20:00 +0200)
CID 1288918 & 1288919

src/lib/emile/emile_image.c

index 06a5da4e88ee57ea59a02a9b0036bc5198632ed3..d0f35a16b3a65666d827ca75be51f28656ffdb9f 100644 (file)
@@ -519,13 +519,19 @@ _emile_tgv_data(Emile_Image *image,
             if (image->compress)
               {
                  if (!emile_expand(data_start, buffer, EMILE_LZ4HC))
-                   goto on_error;
+                   {
+                      eina_binbuf_free(data_start);
+                      goto on_error;
+                   }
               }
             else
               {
                  buffer = data_start;
                  if (block_count * etc_block_size != block_length)
-                   goto on_error;
+                   {
+                      eina_binbuf_free(data_start);
+                      goto on_error;
+                   }
               }
             it = eina_binbuf_string_get(buffer);
 
@@ -635,6 +641,8 @@ _emile_tgv_data(Emile_Image *image,
                         abort();
                      }
                 } /* bx,by inside blocks */
+
+            eina_binbuf_free(data_start);
          } /* x,y macroblocks */
 
    // TODO: Add support for more unpremultiplied modes (ETC2)