]> granicus.if.org Git - imagemagick/commitdiff
GetMagickHomeURL() no longer leaks memory
authorCristy <urban-warrior@imagemagick.org>
Sun, 16 Oct 2016 19:28:40 +0000 (15:28 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sun, 16 Oct 2016 19:29:08 +0000 (15:29 -0400)
MagickCore/resize.c
MagickCore/version.c
coders/dpx.c
coders/fits.c
coders/json.c
coders/pdf.c
coders/wmf.c
configure
configure.ac

index ca95ae5d4f667043b19082174d2433046315f345..d48cf88bca770bf0217ad0c8b461168162fa3d8c 100644 (file)
@@ -3630,6 +3630,7 @@ MagickExport Image *ThumbnailImage(const Image *image,const size_t columns,
 #define SampleFactor  5
 
   char
+    *url,
     value[MagickPathExtent];
 
   const char
@@ -3712,8 +3713,9 @@ MagickExport Image *ThumbnailImage(const Image *image,const size_t columns,
   (void) FormatLocaleString(value,MagickPathExtent,"image/%s",image->magick);
   LocaleLower(value);
   (void) SetImageProperty(thumbnail_image,"Thumb::Mimetype",value,exception);
-  (void) SetImageProperty(thumbnail_image,"software",GetMagickHomeURL(),
-    exception);
+  url=GetMagickHomeURL();
+  (void) SetImageProperty(thumbnail_image,"software",url,exception);
+  url=DestroyString(url);
   (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
     image->magick_columns);
   (void) SetImageProperty(thumbnail_image,"Thumb::Image::Width",value,
index 7127a82ce8efba976794ef89544e38eff7406df5..256bdaa64828e1acec0e12c4bd31c48303ce3427 100644 (file)
@@ -292,9 +292,13 @@ MagickExport char *GetMagickHomeURL(void)
     (void) FormatLocaleString(path,MagickPathExtent,"%s%s%s",element,
       DirectorySeparator,MagickURLFilename);
     if (IsPathAccessible(path) != MagickFalse)
-      return(ConstantString(path));
+      {
+        paths=DestroyLinkedList(paths,RelinquishMagickMemory);
+        return(ConstantString(path));
+      }
     element=(const char *) GetNextValueInLinkedList(paths);
   }
+  paths=DestroyLinkedList(paths,RelinquishMagickMemory);
   return(ConstantString(MagickHomeURL));
 }
 \f
index b4a5fde0ef612f47903747beef0cba535709a623..c1c18a9525ab356332e9aeb3ee210eeaa22366de 100644 (file)
@@ -442,7 +442,7 @@ static size_t GetBytesPerRow(const size_t columns,
     case 16:
     {
       if (pad == MagickFalse)
-        { 
+        {
           bytes_per_row=2*(((size_t) samples_per_pixel*columns*bits_per_pixel+
             15)/16);
           break;
@@ -1440,6 +1440,9 @@ static inline const char *GetDPXProperty(const Image *image,
 static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image,
   ExceptionInfo *exception)
 {
+  char
+    *url;
+
   const char
     *value;
 
@@ -1565,8 +1568,9 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image,
     dpx.file.timestamp);
   offset+=WriteBlob(image,sizeof(dpx.file.timestamp),(unsigned char *)
     dpx.file.timestamp);
-  (void) strncpy(dpx.file.creator,GetMagickHomeURL(),sizeof(dpx.file.creator)-
-    1);
+  url=GetMagickHomeURL();
+  (void) strncpy(dpx.file.creator,url,sizeof(dpx.file.creator)-1);
+  url=DestroyString(url);
   value=GetDPXProperty(image,"dpx:file.creator",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.file.creator,value,sizeof(dpx.file.creator)-1);
index 17c8704ebc591b43d529e8a7113fb772e5f30936..ff4120afd67a0bbd628f4d69b5cad07696a058b8 100644 (file)
@@ -610,8 +610,9 @@ static MagickBooleanType WriteFITSImage(const ImageInfo *image_info,
   Image *image,ExceptionInfo *exception)
 {
   char
+    *fits_info,
     header[FITSBlocksize],
-    *fits_info;
+    *url;
 
   MagickBooleanType
     status;
@@ -712,8 +713,9 @@ static MagickBooleanType WriteFITSImage(const ImageInfo *image_info,
       (void) strncpy(fits_info+offset,header,strlen(header));
       offset+=80;
     }
-  (void) FormatLocaleString(header,FITSBlocksize,"HISTORY %.72s",
-    GetMagickHomeURL());
+  url=GetMagickHomeURL();
+  (void) FormatLocaleString(header,FITSBlocksize,"HISTORY %.72s",url);
+  url=DestroyString(url);
   (void) strncpy(fits_info+offset,header,strlen(header));
   offset+=80;
   (void) strncpy(header,"END",FITSBlocksize);
index ee43d7d722bf71a906b77d9ea285d08512e30a4c..e02d77370bf316deb78add5258709ca3c3dcee5d 100644 (file)
@@ -704,6 +704,9 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file,
   ChannelStatistics
     *channel_statistics;
 
+  char
+    *url;
+
   ColorspaceType
     colorspace;
 
@@ -1569,7 +1572,9 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file,
     (unsigned long) (elapsed_time/60.0),(unsigned long) ceil(fmod(
     elapsed_time,60.0)),(unsigned long) (1000.0*(elapsed_time-floor(
     elapsed_time))));
-  JsonFormatLocaleFile(file,"    \"version\": %s\n",GetMagickHomeURL());
+  url=GetMagickHomeURL();
+  JsonFormatLocaleFile(file,"    \"version\": %s\n",url);
+  url=DestroyString(url);
   (void) FormatLocaleFile(file,"  }\n}\n");
   (void) fflush(file);
   return(ferror(file) != 0 ? MagickFalse : MagickTrue);
index 696588c849a238c3bcf2b1ed022c58b731ddae35..f468693063f7dffa11de4bf47b99ca4774811aa4 100644 (file)
@@ -1201,7 +1201,8 @@ RestoreMSCWarning
     buffer[MagickPathExtent],
     date[MagickPathExtent],
     **labels,
-    page_geometry[MagickPathExtent];
+    page_geometry[MagickPathExtent],
+    *url;
 
   CompressionType
     compression;
@@ -1360,6 +1361,7 @@ RestoreMSCWarning
         create_date[MagickPathExtent],
         modify_date[MagickPathExtent],
         timestamp[MagickPathExtent],
+        *url,
         xmp_profile[MagickPathExtent];
 
       /*
@@ -1380,10 +1382,11 @@ RestoreMSCWarning
       if (value != (const char *) NULL)
         (void) CopyMagickString(create_date,value,MagickPathExtent);
       (void) FormatMagickTime(time((time_t *) NULL),MagickPathExtent,timestamp);
+      url=GetMagickHomeURL();
       i=FormatLocaleString(xmp_profile,MagickPathExtent,XMPProfile,
-        XMPProfileMagick,modify_date,create_date,timestamp,
-        GetMagickHomeURL(),EscapeParenthesis(basename),
-        GetMagickHomeURL());
+        XMPProfileMagick,modify_date,create_date,timestamp,url,
+        EscapeParenthesis(basename),url);
+      url=DestroyString(url);
       (void) FormatLocaleString(buffer,MagickPathExtent,"/Length %.20g\n",
         (double) i);
       (void) WriteBlobString(image,buffer);
@@ -2836,8 +2839,10 @@ RestoreMSCWarning
   (void) WriteBlobString(image,buffer);
   (void) FormatLocaleString(buffer,MagickPathExtent,"/ModDate (%s)\n",date);
   (void) WriteBlobString(image,buffer);
+  url=GetMagickHomeURL();
   (void) FormatLocaleString(buffer,MagickPathExtent,"/Producer (%s)\n",
-    EscapeParenthesis(GetMagickHomeURL()));
+    EscapeParenthesis(url));
+  url=DestroyString(url);
   (void) WriteBlobString(image,buffer);
   (void) WriteBlobString(image,">>\n");
   (void) WriteBlobString(image,"endobj\n");
index 4524bec19439746cb022dd69b07e5fca38f4e16f..0714caafedaac981fbb8e71c6ad4fa4b23e112f8 100644 (file)
@@ -827,7 +827,8 @@ static void ipa_device_close(wmfAPI * API)
 static void ipa_device_begin(wmfAPI * API)
 {
   char
-    comment[MagickPathExtent];
+    comment[MagickPathExtent],
+    *url;
 
   wmf_magick_t
     *ddata = WMF_MAGICK_GetData(API);
@@ -837,8 +838,10 @@ static void ipa_device_begin(wmfAPI * API)
 
   DrawSetViewbox(WmfDrawingWand,0,0,ddata->image->columns,ddata->image->rows);
 
+  url=GetMagickHomeURL();
   (void) FormatLocaleString(comment,MagickPathExtent,
-    "Created by ImageMagick %s",GetMagickHomeURL());
+    "Created by ImageMagick %s",url);
+  url=DestroyString(url);
   DrawComment(WmfDrawingWand,comment);
 
   /* Scale width and height to image */
index 642c699cd18cfa16e53c2be76835ad1f28e57fe7..cd38e78c6c62cf8f1fa05cb956fd7e20ddd64a7a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1947,7 +1947,7 @@ Optional Features:
   --enable-prof           enable 'prof' profiling support
   --enable-gprof          enable 'gprof' profiling support
   --enable-gcov           enable 'gcov' profiling support
-  --enable-legacy-support  install legacy command-line utilities (default disabled)
+  --enable-legacy-support install legacy command-line utilities (default disabled)
   --disable-assert        turn off assertions
   --disable-docs          disable building of documentation
 
@@ -4517,7 +4517,7 @@ MAGICK_PATCHLEVEL_VERSION=5
 
 MAGICK_VERSION=7.0.3-5
 
-MAGICK_GIT_REVISION=18937:83da034:20161010
+MAGICK_GIT_REVISION=18940:62e5ca5:20161016
 
 
 # Substitute library versioning
index 7dbe4f0c648f1b092a84779ea40e95e5500cc5d3..21bc090616ccafd0a0bca97978a70982844758dd 100644 (file)
@@ -774,7 +774,7 @@ fi
 
 # Enable legacy support (default no)
 AC_ARG_ENABLE(legacy-support,
-              [  --enable-legacy-support  install legacy command-line utilities (default disabled)],
+              [  --enable-legacy-support install legacy command-line utilities (default disabled)],
               [with_legacy_support=$enableval],
               [with_legacy_support='no'])
 AM_CONDITIONAL(LEGACY_SUPPORT, test "$with_legacy_support" != 'no')