Fix two memory leaks discovered with Valgrind.

* ftfont.c (ftfont_list) [HAVE_LIBOTF]: Call OTF_close.
* image.c (Fimagemagick_types): Call MagickRelinquishMemory.
This commit is contained in:
Dmitry Antipov 2014-01-23 16:18:08 +04:00
parent c51e81ef55
commit 565935c89f
3 changed files with 20 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2014-01-23 Dmitry Antipov <dmantipov@yandex.ru>
Fix two memory leaks discovered with Valgrind.
* ftfont.c (ftfont_list) [HAVE_LIBOTF]: Call OTF_close.
* image.c (Fimagemagick_types): Call MagickRelinquishMemory.
2014-01-22 Martin Rudalics <rudalics@gmx.at>
Fixes in window size functions around Bug#16430 and Bug#16470.

View file

@ -1011,6 +1011,7 @@ ftfont_list (struct frame *f, Lisp_Object spec)
if (otspec)
{
FcChar8 *file;
bool passed;
OTF *otf;
if (FcPatternGetString (fontset->fonts[i], FC_FILE, 0, &file)
@ -1019,14 +1020,16 @@ ftfont_list (struct frame *f, Lisp_Object spec)
otf = OTF_open ((char *) file);
if (! otf)
continue;
if (OTF_check_features (otf, 1,
otspec->script_tag, otspec->langsys_tag,
otspec->features[0],
otspec->nfeatures[0]) != 1
|| OTF_check_features (otf, 0,
otspec->script_tag, otspec->langsys_tag,
otspec->features[1],
otspec->nfeatures[1]) != 1)
passed = (OTF_check_features (otf, 1, otspec->script_tag,
otspec->langsys_tag,
otspec->features[0],
otspec->nfeatures[0]) == 1
&& OTF_check_features (otf, 0, otspec->script_tag,
otspec->langsys_tag,
otspec->features[1],
otspec->nfeatures[1]) == 1);
OTF_close (otf);
if (!passed)
continue;
}
#endif /* HAVE_LIBOTF */

View file

@ -8546,7 +8546,10 @@ and `imagemagick-types-inhibit'. */)
{
Qimagemagicktype = intern (imtypes[i]);
typelist = Fcons (Qimagemagicktype, typelist);
imtypes[i] = (char *) MagickRelinquishMemory (imtypes[i]);
}
imtypes = (char **) MagickRelinquishMemory (imtypes);
return Fnreverse (typelist);
}