tst-fmon/tst-numeric: switch malloc to static stack space [BZ #19671]
Commit Message
The current test code doesn't check the return value of malloc.
This should rarely (if ever) cause a problem, but rather than add
some return value checks, just statically allocate the buffer on
the stack. This will never fail (or if it does, we've got much
bigger problems that don't matter to the test).
Checked that the tests still pass on x86_64-linux-gnu.
---
localedata/tst-fmon.c | 2 +-
localedata/tst-numeric.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
* Mike Frysinger:
> The current test code doesn't check the return value of malloc.
> This should rarely (if ever) cause a problem, but rather than add
> some return value checks, just statically allocate the buffer on
> the stack. This will never fail (or if it does, we've got much
> bigger problems that don't matter to the test).
This needs a ChangeLog entry.
> - char *s = malloc (201);
> + char s[201];
Please use a enum constant of 200, and also pass it to strfmon.
K think the current 200/201 choice is technically incorrect
(the maximum includes the terminating null byte).
@@ -40,7 +40,7 @@
int
main (int argc, char *argv[])
{
- char *s = malloc (201);
+ char s[201];
if (setlocale (LC_MONETARY, argv[1]) == NULL)
{
@@ -41,7 +41,7 @@
int
main (int argc, char *argv[])
{
- char *s = malloc (201);
+ char s[201];
double val;
/* Make sure to read the value before setting of the locale, as