[prev in list] [next in list] [prev in thread] [next in thread] 

List:       graphicsmagick-commit
Subject:    [GM-commit] GraphicsMagick: PALM: Fix memory leak in error path
From:       GraphicsMagick Commits <graphicsmagick-commit () lists ! sourceforge ! net>
Date:       2017-09-30 21:34:22
Message-ID: mailman.1913.1506807270.12770.graphicsmagick-commit () lists ! sourceforge ! net
[Download RAW message or body]

changeset 3140397ebc5e in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=3140397ebc5e
                
summary: PALM: Fix memory leak in error path

diffstat:

 ChangeLog          |   3 +++
 coders/palm.c      |  11 +++++++++--
 www/Changelog.html |   2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r ecfc103e5c36 -r 3140397ebc5e ChangeLog
--- a/ChangeLog	Sat Sep 30 16:19:52 2017 -0500
+++ b/ChangeLog	Sat Sep 30 16:34:19 2017 -0500
@@ -1,5 +1,8 @@
 2017-09-30  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
+	* coders/palm.c (WritePALMImage): Fix SourceForge issue #489
+	"memory leak in WritePALMImage".
+
 	* coders/rgb.c (ReadRGBImage): Fix SourceForge issue #488 "Memory
 	leak in rgb.c".
 
diff -r ecfc103e5c36 -r 3140397ebc5e coders/palm.c
--- a/coders/palm.c	Sat Sep 30 16:19:52 2017 -0500
+++ b/coders/palm.c	Sat Sep 30 16:34:19 2017 -0500
@@ -1860,10 +1860,17 @@
     }
 
   if (palm_image->compression == FaxCompression)
-    lastrow = MagickAllocateMemory(unsigned char *,bytes_per_row);
+    {
+      lastrow = MagickAllocateMemory(unsigned char *,bytes_per_row);
+      if (lastrow == (unsigned char *) NULL)
+        ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image);
+    }
   one_row = MagickAllocateMemory(unsigned char *,bytes_per_row);
   if (one_row == (unsigned char *) NULL)
-    ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image);
+    {
+      MagickFreeMemory(lastrow);
+      ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image);
+    }
 
   ClearPixelPacket(&transpix);
   for (y=0; y < (int) palm_image->rows; y++)
diff -r ecfc103e5c36 -r 3140397ebc5e www/Changelog.html
--- a/www/Changelog.html	Sat Sep 30 16:19:52 2017 -0500
+++ b/www/Changelog.html	Sat Sep 30 16:34:19 2017 -0500
@@ -38,6 +38,8 @@
 <p>2017-09-30  Bob Friesenhahn  &lt;<a class="reference external" \
href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#6 \
4;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
  <blockquote>
 <ul class="simple">
+<li>coders/palm.c (WritePALMImage): Fix SourceForge issue #489
+&quot;memory leak in WritePALMImage&quot;.</li>
 <li>coders/rgb.c (ReadRGBImage): Fix SourceForge issue #488 &quot;Memory
 leak in rgb.c&quot;.</li>
 <li>coders/palm.c (ReadPALMImage): Fix SourceForge issue #487 &quot;NULL

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Graphicsmagick-commit mailing list
Graphicsmagick-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic