GraphicsMagick: FreeMagickClientData(): Fix Coverity issue 38187...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.14840.1667939221.1567.graphicsmagick-commit@lists.sourceforge.net>
changeset d3f42947a065 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=d3f42947a065
summary: FreeMagickClientData(): Fix Coverity issue 381870 "Null pointer dereferences"

diffstat:

 ChangeLog          |   5 ++++-
 coders/jpeg.c      |  13 ++++++++-----
 www/Changelog.html |   4 +++-
 3 files changed, 15 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r 341387970c85 -r d3f42947a065 ChangeLog
--- a/ChangeLog	Tue Nov 08 14:23:37 2022 -0600
+++ b/ChangeLog	Tue Nov 08 14:26:49 2022 -0600
@@ -1,6 +1,9 @@
 2022-11-08  Bob Friesenhahn  <[email protected]>
 
-	* magick/export.c (ExportViewPixelArea): Fix Coverity issue
+	* coders/jpeg.c (FreeMagickClientData): Fix Coverity issue 381870
+	"Null pointer dereferences".
+
+	* magick/export.c (ExportViewPixelArea): Fix Coverity issue 381871
 	"Control flow issues (DEADCODE)" for the case where QuantumDepth =
 	32.
 
diff -r 341387970c85 -r d3f42947a065 coders/jpeg.c
--- a/coders/jpeg.c	Tue Nov 08 14:23:37 2022 -0600
+++ b/coders/jpeg.c	Tue Nov 08 14:26:49 2022 -0600
@@ -211,13 +211,16 @@
     i;
 
   /* Free profiles data */
-  for (i=0 ; i < ArraySize(client_data->profiles); i++)
+  if (client_data != (MagickClientData *) NULL)
     {
-      MagickFreeMemory(client_data->profiles[i].name);
-      MagickFreeResourceLimitedMemory(client_data->profiles[i].info);
+      for (i=0 ; i < ArraySize(client_data->profiles); i++)
+        {
+          MagickFreeMemory(client_data->profiles[i].name);
+          MagickFreeResourceLimitedMemory(client_data->profiles[i].info);
+        }
+
+      MagickFreeMemory(client_data);
     }
-
-  MagickFreeMemory(client_data);
   return client_data;
 }
 
diff -r 341387970c85 -r d3f42947a065 www/Changelog.html
--- a/www/Changelog.html	Tue Nov 08 14:23:37 2022 -0600
+++ b/www/Changelog.html	Tue Nov 08 14:26:49 2022 -0600
@@ -40,7 +40,9 @@
 <p>2022-11-08  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
-<li><p>magick/export.c (ExportViewPixelArea): Fix Coverity issue
+<li><p>coders/jpeg.c (FreeMagickClientData): Fix Coverity issue 381870
+&quot;Null pointer dereferences&quot;.</p></li>
+<li><p>magick/export.c (ExportViewPixelArea): Fix Coverity issue 381871
 &quot;Control flow issues (DEADCODE)&quot; for the case where QuantumDepth =
 32.</p></li>
 </ul>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.