GetMagickHomeURL() no longer leaks memory
diff --git a/MagickCore/resize.c b/MagickCore/resize.c
index ca95ae5..d48cf88 100644
--- a/MagickCore/resize.c
+++ b/MagickCore/resize.c
@@ -3630,6 +3630,7 @@
#define SampleFactor 5
char
+ *url,
value[MagickPathExtent];
const char
@@ -3712,8 +3713,9 @@
(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,
diff --git a/MagickCore/version.c b/MagickCore/version.c
index 7127a82..256bdaa 100644
--- a/MagickCore/version.c
+++ b/MagickCore/version.c
@@ -292,9 +292,13 @@
(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));
}
diff --git a/coders/dpx.c b/coders/dpx.c
index b4a5fde..c1c18a9 100644
--- a/coders/dpx.c
+++ b/coders/dpx.c
@@ -442,7 +442,7 @@
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 MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
+ char
+ *url;
+
const char
*value;
@@ -1565,8 +1568,9 @@
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);
diff --git a/coders/fits.c b/coders/fits.c
index 17c8704..ff4120a 100644
--- a/coders/fits.c
+++ b/coders/fits.c
@@ -610,8 +610,9 @@
Image *image,ExceptionInfo *exception)
{
char
+ *fits_info,
header[FITSBlocksize],
- *fits_info;
+ *url;
MagickBooleanType
status;
@@ -712,8 +713,9 @@
(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);
diff --git a/coders/json.c b/coders/json.c
index ee43d7d..e02d773 100644
--- a/coders/json.c
+++ b/coders/json.c
@@ -704,6 +704,9 @@
ChannelStatistics
*channel_statistics;
+ char
+ *url;
+
ColorspaceType
colorspace;
@@ -1569,7 +1572,9 @@
(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);
diff --git a/coders/pdf.c b/coders/pdf.c
index 696588c..f468693 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -1201,7 +1201,8 @@
buffer[MagickPathExtent],
date[MagickPathExtent],
**labels,
- page_geometry[MagickPathExtent];
+ page_geometry[MagickPathExtent],
+ *url;
CompressionType
compression;
@@ -1360,6 +1361,7 @@
create_date[MagickPathExtent],
modify_date[MagickPathExtent],
timestamp[MagickPathExtent],
+ *url,
xmp_profile[MagickPathExtent];
/*
@@ -1380,10 +1382,11 @@
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 @@
(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");
diff --git a/coders/wmf.c b/coders/wmf.c
index 4524bec..0714caa 100644
--- a/coders/wmf.c
+++ b/coders/wmf.c
@@ -827,7 +827,8 @@
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 @@
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 */
diff --git a/configure b/configure
index 642c699..cd38e78 100755
--- a/configure
+++ b/configure
@@ -1947,7 +1947,7 @@
--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_VERSION=7.0.3-5
-MAGICK_GIT_REVISION=18937:83da034:20161010
+MAGICK_GIT_REVISION=18940:62e5ca5:20161016
# Substitute library versioning
diff --git a/configure.ac b/configure.ac
index 7dbe4f0..21bc090 100644
--- a/configure.ac
+++ b/configure.ac
@@ -774,7 +774,7 @@
# 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')