mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
(_dl_important_hwcaps): Avoid using malloc early in the program.
This commit is contained in:
@@ -187,16 +187,12 @@ internal_function
|
|||||||
_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
|
_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
|
||||||
size_t *max_capstrlen)
|
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.str = buf; /* Does not really matter. */
|
||||||
result = (struct r_strlenpair *) malloc (sizeof (*result));
|
result.len = 0;
|
||||||
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;
|
|
||||||
|
|
||||||
*sz = 1;
|
*sz = 1;
|
||||||
return result;
|
return &result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user