File xkeycaps-2.46-memory-leak.patch of Package xkeycaps

--- guess.c
+++ guess.c
@@ -79,11 +79,12 @@
       while (all_kbds [j].short_name)
 	{
 	  const char *loser1 = 0, *loser2 = 0;
+          int freeloser2 = 0;
 	  make_long_kbd_name(all_kbds[j].vendor, all_kbds[j].kbd_style, that);
 	  if (!strcmp (all_kbds [i].short_name, all_kbds [j].short_name))
 	    loser1 = "short names", loser2 = all_kbds [j].short_name;
 	  else if (!strcmp (this, that))
-	    loser1 = "long names", loser2 = strdup(that);
+	    loser1 = "long names", (loser2 = strdup(that)) && (freeloser2 = 1);
 	  else if (all_kbds [i].server_id && all_kbds [j].server_id &&
 		   !strcmp (all_kbds [i].server_id, all_kbds [j].server_id))
 	    loser1 = "server ids", loser2 = all_kbds [j].server_id;
@@ -93,6 +94,9 @@
 	    fprintf (stderr,
 		     "%s: DATA ERROR: duplicate %s in all-kbds.h for \"%s\"\n",
 		     progname, loser1, loser2);
+
+          if (freeloser2)
+            free(loser2);
 	}
       i++;
     }
openSUSE Build Service is sponsored by