[gimp] app: allocate the RLE buffer only if we save an RLE-compressed XCF



commit 0d435f11b7ecd3e38d135e7be64888273121f580
Author: Michael Natterer <mitch gimp org>
Date:   Wed Oct 15 23:53:59 2014 +0200

    app: allocate the RLE buffer only if we save an RLE-compressed XCF

 app/xcf/xcf-save.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index b6b7afb..b1c4cff 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -1355,7 +1355,7 @@ xcf_save_level (XcfInfo     *info,
   gint        n_tile_cols;
   guint       ntiles;
   gint        i;
-  guchar     *rlebuf;
+  guchar     *rlebuf    = NULL;
   GError     *tmp_error = NULL;
 
   format = gegl_buffer_get_format (buffer);
@@ -1372,7 +1372,8 @@ xcf_save_level (XcfInfo     *info,
   /* allocate a temporary buffer to store the rle data before it is
    * written to disk
    */
-  rlebuf = g_alloca (XCF_TILE_WIDTH * XCF_TILE_HEIGHT * bpp * 1.5);
+  if (info->compression == COMPRESS_RLE)
+    rlebuf = g_alloca (XCF_TILE_WIDTH * XCF_TILE_HEIGHT * bpp * 1.5);
 
   n_tile_rows = gimp_gegl_buffer_get_n_tile_rows (buffer, XCF_TILE_HEIGHT);
   n_tile_cols = gimp_gegl_buffer_get_n_tile_cols (buffer, XCF_TILE_WIDTH);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]