fix #919466 - fix memory leak in get_default_magic

This commit is contained in:
Jan Kaluza 2013-03-11 08:11:43 +01:00
parent fdd3da2360
commit 79ee98fc16
2 changed files with 8 additions and 5 deletions

View File

@ -1,8 +1,8 @@
diff --git a/src/magic.c b/src/magic.c
index 7eb0441..d8c5835 100644
index 5403951..2b61080 100644
--- a/src/magic.c
+++ b/src/magic.c
@@ -101,16 +101,20 @@ get_default_magic(void)
@@ -101,16 +101,21 @@ get_default_magic(void)
if ((home = getenv("HOME")) == NULL)
return MAGIC;
@ -12,9 +12,9 @@ index 7eb0441..d8c5835 100644
- if (stat(hmagicpath, &st) == -1)
- goto out;
- if (S_ISDIR(st.st_mode)) {
- free(hmagicpath);
- if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
+ if (stat(hmagicpath, &st) == -1) {
free(hmagicpath);
- if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
+ if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
return MAGIC;
- if (access(hmagicpath, R_OK) == -1)

View File

@ -5,7 +5,7 @@
Summary: A utility for determining file types
Name: file
Version: 5.11
Release: 8%{?dist}
Release: 9%{?dist}
License: BSD
Group: Applications/File
Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
@ -166,6 +166,9 @@ cd python
%endif
%changelog
* Mon Mar 11 2013 Jan Kaluza <jkaluza@redhat.com> - 5.11-9
- fix #919466 - fix memory leak in get_default_magic
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.11-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild