summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
Diffstat (limited to 'strings')
-rw-r--r--strings/decimal.c9
-rw-r--r--strings/dtoa.c7
2 files changed, 13 insertions, 3 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index b18a8c3fa50..954b04ea446 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1403,11 +1403,18 @@ int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale)
buf++;
}
my_afree(d_copy);
+
+ /*
+ No digits? We have read the number zero, of unspecified precision.
+ Make it a proper zero, with non-zero precision.
+ */
+ if (to->intg == 0 && to->frac == 0)
+ decimal_make_zero(to);
return error;
err:
my_afree(d_copy);
- decimal_make_zero(((decimal_t*) to));
+ decimal_make_zero(to);
return(E_DEC_BAD_NUM);
}
diff --git a/strings/dtoa.c b/strings/dtoa.c
index e4eb10bb6f8..05c9bb6e529 100644
--- a/strings/dtoa.c
+++ b/strings/dtoa.c
@@ -46,7 +46,7 @@
see if it is possible to get rid of malloc().
this constant is sufficient to avoid malloc() on all inputs I have tried.
*/
-#define DTOA_BUFF_SIZE (420 * sizeof(void *))
+#define DTOA_BUFF_SIZE (460 * sizeof(void *))
/* Magic value returned by dtoa() to indicate overflow */
#define DTOA_OVERFLOW 9999
@@ -659,6 +659,7 @@ typedef struct Stack_alloc
static Bigint *Balloc(int k, Stack_alloc *alloc)
{
Bigint *rv;
+ DBUG_ASSERT(k <= Kmax);
if (k <= Kmax && alloc->freelist[k])
{
rv= alloc->freelist[k];
@@ -1005,7 +1006,7 @@ static Bigint p5_a[]=
static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc)
{
- Bigint *b1, *p5, *p51;
+ Bigint *b1, *p5, *p51=NULL;
int i;
static int p05[3]= { 5, 25, 125 };
@@ -1037,6 +1038,8 @@ static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc)
p5= p51;
}
}
+ if (p51)
+ Bfree(p51, alloc);
return b;
}