Free XkbFile's when no longer needed
Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
c357a11aa6
commit
889a299e3b
|
@ -426,6 +426,7 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
|
|||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -459,6 +460,7 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
|
|||
(*hndlr) (rtrn, xkb, MergeOverride, &next_incl);
|
||||
MergeIncludedCompatMaps(&included, &next_incl, op);
|
||||
ClearCompatInfo(&next_incl, xkb);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "action.h"
|
||||
#include "keycodes.h"
|
||||
#include "alias.h"
|
||||
#include "parseutils.h"
|
||||
|
||||
#define DFLT_FONT "helvetica"
|
||||
#define DFLT_SLANT "r"
|
||||
|
@ -1323,6 +1324,7 @@ HandleIncludeGeometry(IncludeStmt * stmt, struct xkb_desc * xkb, GeometryInfo *
|
|||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1353,6 +1355,7 @@ HandleIncludeGeometry(IncludeStmt * stmt, struct xkb_desc * xkb, GeometryInfo *
|
|||
(*hndlr) (rtrn, xkb, MergeOverride, &next_incl);
|
||||
MergeIncludedGeometry(&included, &next_incl, op);
|
||||
ClearGeometryInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "keycodes.h"
|
||||
#include "misc.h"
|
||||
#include "alias.h"
|
||||
#include "parseutils.h"
|
||||
|
||||
const char *
|
||||
longText(unsigned long val)
|
||||
|
@ -575,6 +576,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_desc * xkb, KeyNamesInfo *
|
|||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -602,6 +604,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_desc * xkb, KeyNamesInfo *
|
|||
HandleKeycodesFile(rtrn, xkb, MergeOverride, &next_incl);
|
||||
MergeIncludedKeycodes(&included, &next_incl, op);
|
||||
ClearKeyNamesInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -83,7 +83,10 @@ CompileKeymap(XkbFile *file, struct xkb_desc * xkb, unsigned merge)
|
|||
/* Check for duplicate entries in the input file */
|
||||
while ((file) && (ok))
|
||||
{
|
||||
file->topName = mainName;
|
||||
if (file->topName != mainName) {
|
||||
free(file->topName);
|
||||
file->topName = strdup(mainName);
|
||||
}
|
||||
if ((have & (1 << file->type)) != 0)
|
||||
{
|
||||
ERROR("More than one %s section in a %s file\n",
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "vmod.h"
|
||||
#include "action.h"
|
||||
#include "misc.h"
|
||||
#include "parseutils.h"
|
||||
|
||||
typedef struct _PreserveInfo
|
||||
{
|
||||
|
@ -390,6 +391,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
|
|||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -418,6 +420,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
|
|||
(*hndlr) (rtrn, xkb, op, &next_incl);
|
||||
MergeIncludedKeyTypes(&included, &next_incl, op, xkb);
|
||||
FreeKeyTypesInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ ProcessIncludeFile(IncludeStmt * stmt,
|
|||
XkbFile ** file_rtrn, unsigned *merge_rtrn)
|
||||
{
|
||||
FILE *file;
|
||||
XkbFile *rtrn, *mapToUse;
|
||||
XkbFile *rtrn, *mapToUse, *next;
|
||||
char oldFile[1024] = {0};
|
||||
int oldLine = lineNum;
|
||||
|
||||
|
@ -85,10 +85,21 @@ ProcessIncludeFile(IncludeStmt * stmt,
|
|||
mapToUse = rtrn;
|
||||
if (stmt->map != NULL)
|
||||
{
|
||||
while ((mapToUse) && ((!uStringEqual(mapToUse->name, stmt->map)) ||
|
||||
(mapToUse->type != file_type)))
|
||||
while (mapToUse)
|
||||
{
|
||||
mapToUse = (XkbFile *) mapToUse->common.next;
|
||||
next = (XkbFile *)mapToUse->common.next;
|
||||
mapToUse->common.next = NULL;
|
||||
if (uStringEqual(mapToUse->name, stmt->map) &&
|
||||
mapToUse->type == file_type)
|
||||
{
|
||||
FreeXKBFile(next);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeXKBFile(mapToUse);
|
||||
}
|
||||
mapToUse = next;
|
||||
}
|
||||
if (!mapToUse)
|
||||
{
|
||||
|
|
|
@ -633,6 +633,9 @@ LookupKeysym(char *str, uint32_t * sym_rtrn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
FreeInclude(IncludeStmt *incl);
|
||||
|
||||
IncludeStmt *
|
||||
IncludeCreate(char *str, unsigned merge)
|
||||
{
|
||||
|
@ -696,20 +699,11 @@ IncludeCreate(char *str, unsigned merge)
|
|||
else
|
||||
free(stmt);
|
||||
return first;
|
||||
|
||||
BAIL:
|
||||
ERROR("Illegal include statement \"%s\"\n", stmt);
|
||||
ACTION("Ignored\n");
|
||||
while (first)
|
||||
{
|
||||
incl = first->next;
|
||||
free(first->file);
|
||||
free(first->map);
|
||||
free(first->modifier);
|
||||
free(first->path);
|
||||
first->file = first->map = first->path = NULL;
|
||||
free(first);
|
||||
first = incl;
|
||||
}
|
||||
FreeInclude(first);
|
||||
free(stmt);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -873,6 +867,7 @@ FreeStmt(ParseCommon *stmt)
|
|||
{
|
||||
case StmtInclude:
|
||||
FreeInclude((IncludeStmt *)stmt);
|
||||
/* stmt is already free'd here. */
|
||||
stmt = NULL;
|
||||
break;
|
||||
case StmtExpr:
|
||||
|
@ -967,7 +962,7 @@ FreeXKBFile(XkbFile *file)
|
|||
}
|
||||
|
||||
free(file->name);
|
||||
/* free(file->topName); */
|
||||
free(file->topName);
|
||||
free(file);
|
||||
file = next;
|
||||
}
|
||||
|
|
|
@ -777,6 +777,7 @@ HandleIncludeSymbols(IncludeStmt * stmt,
|
|||
included.name = stmt->stmt;
|
||||
stmt->stmt = NULL;
|
||||
}
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -813,6 +814,7 @@ HandleIncludeSymbols(IncludeStmt * stmt,
|
|||
(*hndlr) (rtrn, xkb, MergeOverride, &next_incl);
|
||||
MergeIncludedSymbols(&included, &next_incl, op, xkb);
|
||||
FreeSymbolsInfo(&next_incl);
|
||||
FreeXKBFile(rtrn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -225,11 +225,12 @@ xkb_compile_keymap_from_components(const struct xkb_component_names * ktcsg)
|
|||
goto unwind_xkb;
|
||||
}
|
||||
|
||||
FreeXKBFile(file);
|
||||
return xkb;
|
||||
unwind_xkb:
|
||||
XkbcFreeKeyboard(xkb);
|
||||
unwind_file:
|
||||
/* XXX: here's where we would free the XkbFile */
|
||||
FreeXKBFile(file);
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -265,11 +266,12 @@ compile_keymap(XkbFile *file, const char *mapName)
|
|||
goto unwind_xkb;
|
||||
}
|
||||
|
||||
FreeXKBFile(file);
|
||||
return xkb;
|
||||
unwind_xkb:
|
||||
XkbcFreeKeyboard(xkb);
|
||||
unwind_file:
|
||||
/* XXX: here's where we would free the XkbFile */
|
||||
FreeXKBFile(file);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue