Don't leak ActionInfo's

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-03-01 19:25:37 +02:00
parent d67e73bdbd
commit c800c60ace
1 changed files with 10 additions and 1 deletions

View File

@ -135,6 +135,7 @@ static void
ClearCompatInfo(CompatInfo * info, struct xkb_desc * xkb) ClearCompatInfo(CompatInfo * info, struct xkb_desc * xkb)
{ {
int i; int i;
ActionInfo *next;
free(info->name); free(info->name);
info->name = NULL; info->name = NULL;
@ -153,7 +154,11 @@ ClearCompatInfo(CompatInfo * info, struct xkb_desc * xkb)
memset(&info->groupCompat[0], 0, memset(&info->groupCompat[0], 0,
XkbNumKbdGroups * sizeof(GroupCompatInfo)); XkbNumKbdGroups * sizeof(GroupCompatInfo));
info->leds = (LEDInfo *) ClearCommonInfo(&info->leds->defs); info->leds = (LEDInfo *) ClearCommonInfo(&info->leds->defs);
/* 3/30/94 (ef) -- XXX! Should free action info here */ while (info->act) {
next = info->act->next;
free(info->act);
info->act = next;
}
ClearVModInfo(&info->vmods, xkb); ClearVModInfo(&info->vmods, xkb);
} }
@ -426,6 +431,8 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
included.name = stmt->stmt; included.name = stmt->stmt;
stmt->stmt = NULL; stmt->stmt = NULL;
} }
if (info->act != NULL)
included.act = NULL;
FreeXKBFile(rtrn); FreeXKBFile(rtrn);
} }
else else
@ -459,6 +466,8 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
next_incl.act = info->act; next_incl.act = info->act;
(*hndlr) (rtrn, xkb, MergeOverride, &next_incl); (*hndlr) (rtrn, xkb, MergeOverride, &next_incl);
MergeIncludedCompatMaps(&included, &next_incl, op); MergeIncludedCompatMaps(&included, &next_incl, op);
if (info->act != NULL)
next_incl.act = NULL;
ClearCompatInfo(&next_incl, xkb); ClearCompatInfo(&next_incl, xkb);
FreeXKBFile(rtrn); FreeXKBFile(rtrn);
} }