diff options
author | jkh <jkh@FreeBSD.org> | 2003-06-13 00:14:07 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2003-06-13 00:14:07 +0000 |
commit | 56787fa7b199f3e56307c941bd464b9fcfcde7d5 (patch) | |
tree | 8a933dd924bf8f358332d7cf52977b4a04422fc4 /lib/libc/locale/ldpart.c | |
parent | 337a3926640fe092173b6a55d92517d635a96d95 (diff) | |
download | FreeBSD-src-56787fa7b199f3e56307c941bd464b9fcfcde7d5.zip FreeBSD-src-56787fa7b199f3e56307c941bd464b9fcfcde7d5.tar.gz |
Fixes to locale code to properly use indirect pointers in order to prevent
memory leaks (fixes bugs earlier purported to be fixed).
Submitted by: Ed Moy <emoy@apple.com>
Obtained from: Apple Computer, Inc.
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/locale/ldpart.c')
-rw-r--r-- | lib/libc/locale/ldpart.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/locale/ldpart.c b/lib/libc/locale/ldpart.c index ceb8394..62f92fd 100644 --- a/lib/libc/locale/ldpart.c +++ b/lib/libc/locale/ldpart.c @@ -47,7 +47,7 @@ static int split_lines(char *, const char *); int __part_load_locale(const char *name, int *using_locale, - char *locale_buf, + char **locale_buf, const char *category_filename, int locale_buf_size_max, int locale_buf_size_min, @@ -69,7 +69,7 @@ __part_load_locale(const char *name, /* * If the locale name is the same as our cache, use the cache. */ - if (locale_buf != NULL && strcmp(name, locale_buf) == 0) { + if (*locale_buf != NULL && strcmp(name, *locale_buf) == 0) { *using_locale = 1; return (_LDP_CACHE); } @@ -124,10 +124,10 @@ __part_load_locale(const char *name, /* * Record the successful parse in the cache. */ - if (locale_buf != NULL) - free(locale_buf); - locale_buf = lbuf; - for (p = locale_buf, i = 0; i < num_lines; i++) + if (*locale_buf != NULL) + free(*locale_buf); + *locale_buf = lbuf; + for (p = *locale_buf, i = 0; i < num_lines; i++) dst_localebuf[i] = (p += strlen(p) + 1); for (i = num_lines; i < locale_buf_size_max; i++) dst_localebuf[i] = NULL; |