This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi,
Here's an updated patch to fix the crash in bug-ga2 when the system
has no configured ipv6 address. I have taken a different approach of
using libc_freeres_fn instead of the libc_freeres_ptr since the former
gives better control over what is freed; we need that since cache may
or may not be allocated using malloc.
Verified that bug-ga2 works correctly in both cases and does not have
memory leaks in either of them.
Siddhesh
[BZ #17125]
* sysdeps/unix/sysv/linux/check_pf.c (cache): Don't use
libc_freeres_ptr.
(freecache): New function to free CACHE on exit.
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 1bc1def..c7fd9b0 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -61,7 +61,7 @@ static struct cached_data noai6ai_cached =
.in6ailen = 0
};
-libc_freeres_ptr (static struct cached_data *cache);
+static struct cached_data *cache;
__libc_lock_define_initialized (static, lock);
@@ -401,6 +401,12 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
*seen_ipv6 = true;
}
+/* Free the cache if it has been allocated. */
+libc_freeres_fn (freecache)
+{
+ if (cache)
+ __free_in6ai (cache->in6ai);
+}
void
__free_in6ai (struct in6addrinfo *ai)
Attachment:
pgpekysCCfpIu.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |