Fix a leak in the previous commit

Also, restore dist macro that was accidentally removed

Resolves: #1540939
This commit is contained in:
Robbie Harwood 2018-02-12 12:35:25 -05:00
parent bfe3c598b5
commit c4848e3332
2 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
From 5d5a6a48e9529fccac9e4c3487577276f8da69ef Mon Sep 17 00:00:00 2001 From c7c44bbd80beabe7fb21f5fb6cfb9b57faa320f4 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com> From: Robbie Harwood <rharwood@redhat.com>
Date: Mon, 29 Jan 2018 12:10:53 +0100 Date: Mon, 29 Jan 2018 12:10:53 +0100
Subject: [PATCH] Process included directories in alphabetical order Subject: [PATCH] Process included directories in alphabetical order
@ -7,13 +7,13 @@ readdir() and FindFirstFile()/FindNextFile() do not define any
ordering on the entries they return. Use sorted scandir() instead on ordering on the entries they return. Use sorted scandir() instead on
Unix-likes. Unix-likes.
(cherry picked from commit c2734538945d284a21bc8ad17404fca1eecdcf86) (cherry picked from commit 4e8518baeedf376ae3e4ce302c9a138263d648df)
--- ---
src/util/profile/prof_parse.c | 26 ++++++++++++++++---------- src/util/profile/prof_parse.c | 30 ++++++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-) 1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c
index 1baceea9e..6c77f3a0c 100644 index 1baceea9e..309c27d07 100644
--- a/src/util/profile/prof_parse.c --- a/src/util/profile/prof_parse.c
+++ b/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c
@@ -241,12 +241,18 @@ static int valid_name(const char *filename) @@ -241,12 +241,18 @@ static int valid_name(const char *filename)
@ -36,7 +36,7 @@ index 1baceea9e..6c77f3a0c 100644
*/ */
static errcode_t parse_include_dir(const char *dirname, static errcode_t parse_include_dir(const char *dirname,
struct profile_node *root_section) struct profile_node *root_section)
@@ -287,18 +293,17 @@ cleanup: @@ -287,18 +293,19 @@ cleanup:
#else /* not _WIN32 */ #else /* not _WIN32 */
@ -58,15 +58,19 @@ index 1baceea9e..6c77f3a0c 100644
- if (asprintf(&pathname, "%s/%s", dirname, ent->d_name) < 0) { - if (asprintf(&pathname, "%s/%s", dirname, ent->d_name) < 0) {
+ +
+ for (i = 0; i < num_ents; i++) { + for (i = 0; i < num_ents; i++) {
+ if (asprintf(&pathname, "%s/%s", dirname, namelist[i]->d_name) < 0) { + retval = asprintf(&pathname, "%s/%s", dirname, namelist[i]->d_name);
+ free(namelist[i]);
+ if (retval < 0) {
retval = ENOMEM; retval = ENOMEM;
break; break;
} }
@@ -307,7 +312,8 @@ cleanup: @@ -307,7 +314,10 @@ cleanup:
if (retval) if (retval)
break; break;
} }
- closedir(dir); - closedir(dir);
+ for (i++; i < num_ents; i++)
+ free(namelist[i]);
+ +
+ free(namelist); + free(namelist);
return retval; return retval;

View File

@ -18,7 +18,7 @@ Summary: The Kerberos network authentication system
Name: krb5 Name: krb5
Version: 1.16 Version: 1.16
# for prerelease, should be e.g., 0.% {prerelease}.1% { ?dist } (without spaces) # for prerelease, should be e.g., 0.% {prerelease}.1% { ?dist } (without spaces)
Release: 5 Release: 6%{?dist}
# lookaside-cached sources; two downloads and a build artifact # lookaside-cached sources; two downloads and a build artifact
Source0: https://web.mit.edu/kerberos/dist/krb5/1.16/krb5-%{version}%{prerelease}.tar.gz Source0: https://web.mit.edu/kerberos/dist/krb5/1.16/krb5-%{version}%{prerelease}.tar.gz
@ -714,6 +714,11 @@ exit 0
%{_libdir}/libkadm5srv_mit.so.* %{_libdir}/libkadm5srv_mit.so.*
%changelog %changelog
* Mon Feb 12 2018 Robbie Harwood <rharwood@redhat.com> - 1.16-6
- Fix a leak in the previous commit
- Restore dist macro that was accidentally removed
- Resolves: #1540939
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.16-5 * Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.16-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild