]> granicus.if.org Git - imagemagick/commitdiff
Be safe, call libraw_strerr() before we close the library
authorCristy <urban-warrior@imagemagick.org>
Sun, 23 Jul 2017 23:15:46 +0000 (19:15 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sun, 23 Jul 2017 23:16:33 +0000 (19:16 -0400)
coders/dng.c

index b25ea95e79578a0cfacde600af757e89f0d48816..e58dc5167cab086f5af1f41408593263e2b8f882 100644 (file)
@@ -228,18 +228,18 @@ static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
     errcode=libraw_unpack(raw_info);
     if (errcode != LIBRAW_SUCCESS)
       {
-        libraw_close(raw_info);
         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
           libraw_strerror(errcode),"`%s'",image->filename);
+        libraw_close(raw_info);
         return(DestroyImageList(image));
       }
     raw_info->params.output_bps=16;
     errcode=libraw_dcraw_process(raw_info);
     if (errcode != LIBRAW_SUCCESS)
       {
-        libraw_close(raw_info);
         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
           libraw_strerror(errcode),"`%s'",image->filename);
+        libraw_close(raw_info);
         return(DestroyImageList(image));
       }
     raw_image=libraw_dcraw_make_mem_image(raw_info,&errcode);
@@ -250,9 +250,9 @@ static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       {
         if (raw_image != (libraw_processed_image_t *) NULL)
           libraw_dcraw_clear_mem(raw_image);
-        libraw_close(raw_info);
         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
           libraw_strerror(errcode),"`%s'",image->filename);
+        libraw_close(raw_info);
         return(DestroyImageList(image));
       }
     image->columns=raw_image->width;