summaryrefslogtreecommitdiff
path: root/strings/dtoa.c
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-09-20 10:59:48 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2011-09-20 10:59:48 +0200
commitdbcdad7d4a726a28aa0a210a674ec26d1ac5c98e (patch)
tree97dad6721f0a7fe5c025bd5628221d9a66e85f4d /strings/dtoa.c
parent3ad46f8111ac049c64ab3a9703c5c3f148aab162 (diff)
downloadmariadb-git-dbcdad7d4a726a28aa0a210a674ec26d1ac5c98e.tar.gz
Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY
mysql-test/r/func_str.result: New test cases. mysql-test/t/func_str.test: New test cases. strings/dtoa.c: Increasing the buffer size slightly made some queries pass without leaks. Adding Bfree(p51, alloc) fixed the remaining leaks.
Diffstat (limited to 'strings/dtoa.c')
-rw-r--r--strings/dtoa.c7
1 files changed, 5 insertions, 2 deletions
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;
}