mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
Fix memory allocation for small number of digits
svn path=/trunk/; revision=42616
This commit is contained in:
parent
85fc2afbaa
commit
dd9eabe375
1 changed files with 3 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#define NUMBER_EFMT 18 /* sign, dot, null, 15 for alignment */
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -17,7 +18,7 @@ _ecvt (double value, int ndigits, int *decpt, int *sign)
|
|||
static char ecvtbuf[DBL_MAX_10_EXP + 10];
|
||||
char *cvtbuf, *s, *d;
|
||||
|
||||
s = cvtbuf = (char*)malloc(ndigits + 18); /* sign, dot, null, 15 for alignment */
|
||||
s = cvtbuf = (char*)malloc(ndigits + NUMBER_EFMT);
|
||||
d = ecvtbuf;
|
||||
|
||||
*sign = 0;
|
||||
|
@ -90,7 +91,7 @@ _ecvt (double value, int ndigits, int *decpt, int *sign)
|
|||
if (ndigits < 1)
|
||||
{
|
||||
/* Need enhanced precision*/
|
||||
char* tbuf = (char*)malloc(ndigits + 18);
|
||||
char* tbuf = (char*)malloc(NUMBER_EFMT);
|
||||
if (tbuf == NULL)
|
||||
{
|
||||
free(cvtbuf);
|
||||
|
|
Loading…
Reference in a new issue