aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/strfmon.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2008-04-19 07:22:58 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2008-04-19 07:22:58 +0000
commit5b30d6ca7796d82bf6bd40c559f29c86b07ba572 (patch)
treedc89847369cbade0fad425f69ba124ba5289cc01 /lib/libc/stdlib/strfmon.c
parent3890416f9c76b1736442d49b1f46e603eebee87b (diff)
downloadsrc-5b30d6ca7796d82bf6bd40c559f29c86b07ba572.tar.gz
src-5b30d6ca7796d82bf6bd40c559f29c86b07ba572.zip
Don't forget to free() currency_symbol and asciivalue when multiple
conversion specifiers for them are present. Submitted by: Maxim Dounin <mdounin@mdounin.ru> Obtained from: NetBSD (partially) MFC after: 3 days
Notes
Notes: svn path=/head/; revision=178313
Diffstat (limited to 'lib/libc/stdlib/strfmon.c')
-rw-r--r--lib/libc/stdlib/strfmon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c
index abfa33249223..20c69be422cb 100644
--- a/lib/libc/stdlib/strfmon.c
+++ b/lib/libc/stdlib/strfmon.c
@@ -225,6 +225,8 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
goto format_error;
}
+ if (currency_symbol != NULL)
+ free(currency_symbol);
if (flags & USE_INTL_CURRENCY) {
currency_symbol = strdup(lc->int_curr_symbol);
if (currency_symbol != NULL)
@@ -253,6 +255,8 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
pad_size = 0;
}
+ if (asciivalue != NULL)
+ free(asciivalue);
asciivalue = __format_grouped_double(value, &flags,
left_prec, right_prec, pad_char);
if (asciivalue == NULL)