]> granicus.if.org Git - imagemagick/commitdiff
Fixed potential memory leak.
authorDirk Lemstra <dirk@git.imagemagick.org>
Mon, 19 Jun 2017 20:59:45 +0000 (22:59 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Mon, 19 Jun 2017 20:59:45 +0000 (22:59 +0200)
coders/screenshot.c

index e9223c73926204e17e2f690d1e3147cf9d4633f0..e2e6d8605acc09bbb03dd27db1f2b7abdb553e6a 100644 (file)
@@ -165,13 +165,13 @@ static Image *ReadSCREENSHOTImage(const ImageInfo *image_info,
       screen->columns=(size_t) GetDeviceCaps(hDC,HORZRES);
       screen->rows=(size_t) GetDeviceCaps(hDC,VERTRES);
       screen->storage_class=DirectClass;
-      status=SetImageExtent(screen,screen->columns,screen->rows,exception);
-      if (status == MagickFalse)
-        return(DestroyImageList(image));
       if (image == (Image *) NULL)
         image=screen;
       else
         AppendImageToList(&image,screen);
+      status=SetImageExtent(screen,screen->columns,screen->rows,exception);
+      if (status == MagickFalse)
+        return(DestroyImageList(image));
 
       bitmapDC=CreateCompatibleDC(hDC);
       if (bitmapDC == (HDC) NULL)