]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 21 Dec 2010 20:46:59 +0000 (20:46 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 21 Dec 2010 20:46:59 +0000 (20:46 +0000)
coders/miff.c

index 2fe3467467a7ab32cda20747b4a18bf8a4af4db1..77e72dfea1e59ec9ad619e998ecb02d81ee0ed05 100644 (file)
@@ -1269,14 +1269,14 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
 #if defined(MAGICKCORE_LZMA_DELEGATE)
       case LZMACompression:
       {
+        (void) ResetMagickMemory(&allocator,0,sizeof(allocator));
+        allocator.alloc=AcquireLZMAMemory;
+        allocator.free=RelinquishLZMAMemory;
         lzma_info=initialize_lzma;
+        lzma_info.allocator=(&allocator);
         code=lzma_auto_decoder(&lzma_info,-1,0);
         if (code != LZMA_OK)
           status=MagickFalse;
-        allocator.alloc=AcquireLZMAMemory;
-        allocator.free=RelinquishLZMAMemory;
-        allocator.opaque=(void *) NULL;
-        lzma_info.allocator=(&allocator);
         lzma_info.avail_in=0;
         break;
       }
@@ -2271,14 +2271,14 @@ static MagickBooleanType WriteMIFFImage(const ImageInfo *image_info,
 #if defined(MAGICKCORE_LZMA_DELEGATE)
       case LZMACompression:
       {
-        lzma_info=initialize_lzma;
-        code=lzma_easy_encoder(&lzma_info,image->quality/10,LZMA_CHECK_SHA256);
-        if (code != LZMA_OK)
-          status=MagickTrue;
         (void) ResetMagickMemory(&allocator,0,sizeof(allocator));
         allocator.alloc=AcquireLZMAMemory;
         allocator.free=RelinquishLZMAMemory;
+        lzma_info=initialize_lzma;
         lzma_info.allocator=&allocator;
+        code=lzma_easy_encoder(&lzma_info,image->quality/10,LZMA_CHECK_SHA256);
+        if (code != LZMA_OK)
+          status=MagickTrue;
         break;
       }
 #endif