diff options
Diffstat (limited to 'util/nvramtool/cmos_lowlevel.c')
-rw-r--r-- | util/nvramtool/cmos_lowlevel.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/util/nvramtool/cmos_lowlevel.c b/util/nvramtool/cmos_lowlevel.c index ef0c3832b1..618e8d2b27 100644 --- a/util/nvramtool/cmos_lowlevel.c +++ b/util/nvramtool/cmos_lowlevel.c @@ -125,13 +125,16 @@ unsigned long long cmos_read(const cmos_entry_t * e) result = 0; if (e->config == CMOS_ENTRY_STRING) { - char *newstring = calloc(1, (length + 7) / 8); + int strsz = (length + 7) / 8; + char *newstring = alloca(strsz); unsigned usize = (8 * sizeof(unsigned long long)); if (!newstring) { out_of_memory(); } + memset(newstring, 0, strsz); + for (next_bit = 0, bits_left = length; bits_left; next_bit += nr_bits, bits_left -= nr_bits) { nr_bits = cmos_bit_op_strategy(bit + next_bit, |