Don't leak the "minimum"/"maximum" string Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 69f87d1..bd8b837 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -674,7 +674,7 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info)
{
ERROR("Unknown element %s encountered\n", tmp.str);
ACTION("Default for field %s ignored\n", field.str);
- return 0;
+ goto err_out;
}
if (uStrCaseCmp(field.str, "minimum") == 0)
which = MIN_KEYCODE_DEF;
@@ -684,19 +684,19 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info)
{
ERROR("Unknown field encountered\n");
ACTION("Assigment to field %s ignored\n", field.str);
- return 0;
+ goto err_out;
}
if (arrayNdx != NULL)
{
ERROR("The %s setting is not an array\n", field.str);
ACTION("Illegal array reference ignored\n");
- return 0;
+ goto err_out;
}
if (ExprResolveKeyCode(stmt->value, &tmp) == 0)
{
ACTION("Assignment to field %s ignored\n", field.str);
- return 0;
+ goto err_out;
}
if (tmp.uval > XKB_KEYCODE_MAX)
{
@@ -704,7 +704,7 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info)
("Illegal keycode %d (must be in the range %d-%d inclusive)\n",
tmp.uval, 0, XKB_KEYCODE_MAX);
ACTION("Value of \"%s\" not changed\n", field.str);
- return 0;
+ goto err_out;
}
if (which == MIN_KEYCODE_DEF)
{
@@ -714,7 +714,7 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info)
("Minimum key code (%d) must be <= maximum key code (%d)\n",
tmp.uval, info->explicitMax);
ACTION("Minimum key code value not changed\n");
- return 0;
+ goto err_out;
}
if ((info->computedMax > 0) && (info->computedMin < tmp.uval))
{
@@ -722,7 +722,7 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info)
("Minimum key code (%d) must be <= lowest defined key (%d)\n",
tmp.uval, info->computedMin);
ACTION("Minimum key code value not changed\n");
- return 0;
+ goto err_out;
}
info->explicitMin = tmp.uval;
}
@@ -733,7 +733,7 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info)
ERROR("Maximum code (%d) must be >= minimum key code (%d)\n",
tmp.uval, info->explicitMin);
ACTION("Maximum code value not changed\n");
- return 0;
+ goto err_out;
}
if ((info->computedMax > 0) && (info->computedMax > tmp.uval))
{
@@ -741,11 +741,17 @@ HandleKeyNameVar(VarDef * stmt, KeyNamesInfo * info)
("Maximum code (%d) must be >= highest defined key (%d)\n",
tmp.uval, info->computedMax);
ACTION("Maximum code value not changed\n");
- return 0;
+ goto err_out;
}
info->explicitMax = tmp.uval;
}
+
+ free(field.str);
return 1;
+
+err_out:
+ free(field.str);
+ return 0;
}
static int