xkbcomp: Don't leak atom text and string exprs, again
authorDaniel Stone <daniel@fooishbar.org>
Tue, 15 Jun 2010 14:23:23 +0000 (15:23 +0100)
committerDaniel Stone <daniel@fooishbar.org>
Tue, 22 Jun 2010 14:56:56 +0000 (15:56 +0100)
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
src/xkbcomp/indicators.c
src/xkbcomp/keycodes.c

index 69036c7..726d37b 100644 (file)
@@ -360,6 +360,8 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
             ok = SetIndicatorMapField(&led, xkb, field.str, arrayNdx,
                                       var->value) && ok;
         }
+        free(elem.str);
+        free(field.str);
     }
     if (ok)
     {
@@ -480,7 +482,7 @@ BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
                         ERROR("No unnamed indicators found\n");
                         ACTION
                             ("Virtual indicator map \"%s\" not bound\n",
-                             XkbcAtomGetString(led->name));
+                             XkbcAtomText(led->name));
                         continue;
                     }
                 }
@@ -515,8 +517,8 @@ BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
                 ERROR("Multiple names bound to indicator %d\n",
                        (unsigned int) led->indicator);
                 ACTION("Using %s, ignoring %s\n",
-                        XkbcAtomGetString(old),
-                        XkbcAtomGetString(led->name));
+                        XkbcAtomText(old),
+                        XkbcAtomText(led->name));
                 led->indicator = _LED_NotBound;
                 if (force)
                 {
index 7a77737..847cfb8 100644 (file)
@@ -730,6 +730,7 @@ HandleIndicatorNameDef(IndicatorNameDef * def,
         return ReportBadType("indicator", "name", buf, "string");
     }
     ii.name = XkbcInternAtom(tmp.str, False);
+    free(tmp.str);
     ii.virtual = def->virtual;
     if (!AddIndicatorName(info, &ii))
         return False;
@@ -872,8 +873,7 @@ CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
             for (ii = info.leds; ii != NULL;
                  ii = (IndicatorNameInfo *) ii->defs.next)
             {
-                xkb->names->indicators[ii->ndx - 1] =
-                    XkbcInternAtom(XkbcAtomGetString(ii->name), False);
+                xkb->names->indicators[ii->ndx - 1] = ii->name;
                 if (xkb->indicators != NULL)
                 {
                     register unsigned bit;