summaryrefslogtreecommitdiff
path: root/dbug
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2012-02-08 21:55:40 +0100
committerunknown <knielsen@knielsen-hq.org>2012-02-08 21:55:40 +0100
commita03d8465769974e0254e4e4acb8aa59617453f9f (patch)
tree8669f9cd5c8d40ddc3911e0378e8fa350d3e74ef /dbug
parent9f9ecc0626b7ef0c54db0d43fd96e7193b907346 (diff)
downloadmariadb-git-a03d8465769974e0254e4e4acb8aa59617453f9f.tar.gz
Fix memory leak when one +O debug on top of another.
Diffstat (limited to 'dbug')
-rw-r--r--dbug/dbug.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 8b3927d2427..cac544b6cd3 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1863,6 +1863,8 @@ static void DBUGOpenFile(CODE_STATE *cs,
name=cs->stack->name;
if (strcmp(name, "-") == 0)
{
+ if (!is_shared(cs->stack, out_file))
+ DBUGCloseFile(cs, cs->stack->out_file);
cs->stack->out_file= stdout;
cs->stack->flags |= FLUSH_ON_WRITE;
cs->stack->name[0]=0;
@@ -1885,6 +1887,8 @@ static void DBUGOpenFile(CODE_STATE *cs,
}
else
{
+ if (!is_shared(cs->stack, out_file))
+ DBUGCloseFile(cs, cs->stack->out_file);
cs->stack->out_file= fp;
}
}