* [committed 2.34 1/5] ldconfig: avoid leak on empty paths in config file
@ 2021-08-04 10:27 Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 2/5] gconv_parseconfdir: Fix memory leak Siddhesh Poyarekar
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2021-08-04 10:27 UTC (permalink / raw)
To: libc-stable; +Cc: Arjun Shankar
Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit b0234d79e7d82475d1666f25326ec045c045b3ed)
---
elf/ldconfig.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 1037e8d0cf..b8893637f8 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -503,7 +503,11 @@ add_dir_1 (const char *line, const char *from_file, int from_line)
entry->path[--i] = '\0';
if (i == 0)
- return;
+ {
+ free (entry->path);
+ free (entry);
+ return;
+ }
char *path = entry->path;
if (opt_chroot != NULL)
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [committed 2.34 2/5] gconv_parseconfdir: Fix memory leak
2021-08-04 10:27 [committed 2.34 1/5] ldconfig: avoid leak on empty paths in config file Siddhesh Poyarekar
@ 2021-08-04 10:27 ` Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 3/5] gaiconf_init: Avoid double-free in label and precedence lists Siddhesh Poyarekar
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2021-08-04 10:27 UTC (permalink / raw)
To: libc-stable; +Cc: Arjun Shankar
The allocated `conf` would leak if we have to skip over the file due
to the underlying filesystem not supporting dt_type.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit 5f9b78fe35d08739b6da1e5b356786d41116c108)
---
iconv/gconv_parseconfdir.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
index a4153e54c6..2f062689ec 100644
--- a/iconv/gconv_parseconfdir.h
+++ b/iconv/gconv_parseconfdir.h
@@ -153,12 +153,11 @@ gconv_parseconfdir (const char *dir, size_t dir_len)
struct stat64 st;
if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0)
continue;
- if (ent->d_type == DT_UNKNOWN
- && (lstat64 (conf, &st) == -1
- || !S_ISREG (st.st_mode)))
- continue;
- found |= read_conf_file (conf, dir, dir_len);
+ if (ent->d_type != DT_UNKNOWN
+ || (lstat64 (conf, &st) != -1 && S_ISREG (st.st_mode)))
+ found |= read_conf_file (conf, dir, dir_len);
+
free (conf);
}
}
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [committed 2.34 3/5] gaiconf_init: Avoid double-free in label and precedence lists
2021-08-04 10:27 [committed 2.34 1/5] ldconfig: avoid leak on empty paths in config file Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 2/5] gconv_parseconfdir: Fix memory leak Siddhesh Poyarekar
@ 2021-08-04 10:27 ` Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 4/5] copy_and_spawn_sgid: Avoid double calls to close() Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 5/5] iconv_charmap: Close output file when done Siddhesh Poyarekar
3 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2021-08-04 10:27 UTC (permalink / raw)
To: libc-stable; +Cc: Arjun Shankar
labellist and precedencelist could get freed a second time if there
are allocation failures, so set them to NULL to avoid a double-free.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit 77a34079d8f3d63b61543bf3af93043f8674e4c4)
---
sysdeps/posix/getaddrinfo.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 838a68f022..43dfc6739e 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2008,6 +2008,7 @@ gaiconf_init (void)
l = l->next;
}
free_prefixlist (labellist);
+ labellist = NULL;
/* Sort the entries so that the most specific ones are at
the beginning. */
@@ -2046,6 +2047,7 @@ gaiconf_init (void)
l = l->next;
}
free_prefixlist (precedencelist);
+ precedencelist = NULL;
/* Sort the entries so that the most specific ones are at
the beginning. */
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [committed 2.34 4/5] copy_and_spawn_sgid: Avoid double calls to close()
2021-08-04 10:27 [committed 2.34 1/5] ldconfig: avoid leak on empty paths in config file Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 2/5] gconv_parseconfdir: Fix memory leak Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 3/5] gaiconf_init: Avoid double-free in label and precedence lists Siddhesh Poyarekar
@ 2021-08-04 10:27 ` Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 5/5] iconv_charmap: Close output file when done Siddhesh Poyarekar
3 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2021-08-04 10:27 UTC (permalink / raw)
To: libc-stable; +Cc: Arjun Shankar
If close() on infd and outfd succeeded, reset the fd numbers so that
we don't attempt to close them again.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit 45caed9d67a00af917d8b5b88d4b5eb1225b7aef)
---
support/support_capture_subprocess.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
index 27bfd19c93..0bacf6dbc2 100644
--- a/support/support_capture_subprocess.c
+++ b/support/support_capture_subprocess.c
@@ -170,6 +170,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
support_subprogram because we only want the program exit status, not the
contents. */
ret = 0;
+ infd = outfd = -1;
char * const args[] = {execname, child_id, NULL};
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [committed 2.34 5/5] iconv_charmap: Close output file when done
2021-08-04 10:27 [committed 2.34 1/5] ldconfig: avoid leak on empty paths in config file Siddhesh Poyarekar
` (2 preceding siblings ...)
2021-08-04 10:27 ` [committed 2.34 4/5] copy_and_spawn_sgid: Avoid double calls to close() Siddhesh Poyarekar
@ 2021-08-04 10:27 ` Siddhesh Poyarekar
3 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2021-08-04 10:27 UTC (permalink / raw)
To: libc-stable; +Cc: Arjun Shankar
Reviewed-by: Arjun Shankar <arjun@redhat.com>
(cherry picked from commit 1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff)
---
iconv/iconv_charmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
index e2d53fee3c..a8b6b56124 100644
--- a/iconv/iconv_charmap.c
+++ b/iconv/iconv_charmap.c
@@ -234,6 +234,8 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
while (++remaining < argc);
/* All done. */
+ if (output != stdout)
+ fclose (output);
free_table (cvtbl);
return status;
}
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-04 10:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 10:27 [committed 2.34 1/5] ldconfig: avoid leak on empty paths in config file Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 2/5] gconv_parseconfdir: Fix memory leak Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 3/5] gaiconf_init: Avoid double-free in label and precedence lists Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 4/5] copy_and_spawn_sgid: Avoid double calls to close() Siddhesh Poyarekar
2021-08-04 10:27 ` [committed 2.34 5/5] iconv_charmap: Close output file when done Siddhesh Poyarekar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).