public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tst-fmon/tst-numeric: switch malloc to static stack space [BZ #19671]
@ 2016-04-22 21:12 Mike Frysinger
  2016-04-23 12:24 ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2016-04-22 21:12 UTC (permalink / raw)
  To: libc-alpha

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(-)

diff --git a/localedata/tst-fmon.c b/localedata/tst-fmon.c
index 995cf90..1359775 100644
--- a/localedata/tst-fmon.c
+++ b/localedata/tst-fmon.c
@@ -40,7 +40,7 @@
 int
 main (int argc, char *argv[])
 {
-  char *s = malloc (201);
+  char s[201];
 
   if (setlocale (LC_MONETARY, argv[1]) == NULL)
     {
diff --git a/localedata/tst-numeric.c b/localedata/tst-numeric.c
index 46a6b48..ac06965 100644
--- a/localedata/tst-numeric.c
+++ b/localedata/tst-numeric.c
@@ -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
-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-23 20:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 21:12 [PATCH] tst-fmon/tst-numeric: switch malloc to static stack space [BZ #19671] Mike Frysinger
2016-04-23 12:24 ` Florian Weimer
2016-04-23 18:25   ` Mike Frysinger
2016-04-23 20:05     ` Florian Weimer

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).