summaryrefslogtreecommitdiff
path: root/dbug
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-03-24 21:51:10 +0100
committerSergei Golubchik <sergii@pisem.net>2012-03-24 21:51:10 +0100
commit6f79b3fa8341be46b4e40fcbf96262fee345b96e (patch)
treed39fc6f92ce83ad788c6775725b09bb03f30ffe8 /dbug
parent99aa3d465e9141fdcc7bbd93d4c7f6cfecb27165 (diff)
downloadmariadb-git-6f79b3fa8341be46b4e40fcbf96262fee345b96e.tar.gz
fix a memory leak in dbug
Diffstat (limited to 'dbug')
-rw-r--r--dbug/dbug.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 9aa788446bf..af0a937ff07 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1624,7 +1624,7 @@ static void FreeState(CODE_STATE *cs, int free_state)
*/
void _db_end_()
{
- CODE_STATE *cs;
+ CODE_STATE *cs, dummy_cs;
/*
Set _dbug_on_ to be able to do full reset even when DEBUGGER_OFF was
called after dbug was initialized
@@ -1633,8 +1633,18 @@ void _db_end_()
cs= code_state();
if (cs)
+ {
while (cs->stack && cs->stack != &init_settings)
FreeState(cs, 1);
+ }
+ else
+ {
+ cs= &dummy_cs;
+ bzero(cs, sizeof(*cs));
+ }
+
+ cs->stack= &init_settings;
+ FreeState(cs, 0);
}