about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-07-27 03:48:11 +0000
committerUlrich Drepper <drepper@redhat.com>2001-07-27 03:48:11 +0000
commit821563a985e1de6923aa6a94555944e2e833937d (patch)
treeeffa5d36d83da0069114df0941305930d159c4f7
parente19ca4d27245832abd875bc61e4dc37c4499151d (diff)
downloadglibc-821563a985e1de6923aa6a94555944e2e833937d.tar.gz
glibc-821563a985e1de6923aa6a94555944e2e833937d.tar.xz
glibc-821563a985e1de6923aa6a94555944e2e833937d.zip
(_dl_important_hwcaps): Avoid using malloc early in the program.
-rw-r--r--elf/dl-support.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 09822218eb..cd56ed411f 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -187,16 +187,12 @@ internal_function
 _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
 		      size_t *max_capstrlen)
 {
-  struct r_strlenpair *result;
+  static struct r_strlenpair result;
+  static char buf[1];
 
-  /* XXX We don't try to find the capabilities in this case.  */
-  result = (struct r_strlenpair *) malloc (sizeof (*result));
-  if (result == NULL)
-    _dl_signal_error (ENOMEM, NULL, N_("cannot create capability list"));
-
-  result[0].str = (char *) result;	/* Does not really matter.  */
-  result[0].len = 0;
+  result.str = buf;	/* Does not really matter.  */
+  result.len = 0;
 
   *sz = 1;
-  return result;
+  return &result;
 }