Author: gschneider
Date: Tue Aug 11 16:01:44 2009
New Revision: 42616
URL:
http://svn.reactos.org/svn/reactos?rev=42616&view=rev
Log:
Fix memory allocation for small number of digits
Modified:
trunk/reactos/lib/sdk/crt/stdlib/ecvt.c
Modified: trunk/reactos/lib/sdk/crt/stdlib/ecvt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/ecvt.c?…
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdlib/ecvt.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdlib/ecvt.c [iso-8859-1] Tue Aug 11 16:01:44 2009
@@ -7,6 +7,7 @@
*/
#include <precomp.h>
+#define NUMBER_EFMT 18 /* sign, dot, null, 15 for alignment */
/*
* @implemented
@@ -17,7 +18,7 @@
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 @@
if (ndigits < 1)
{
/* Need enhanced precision*/
- char* tbuf = (char*)malloc(ndigits + 18);
+ char* tbuf = (char*)malloc(NUMBER_EFMT);
if (tbuf == NULL)
{
free(cvtbuf);