input: fix a leak
[libpicofe.git] / linux / in_evdev.c
index 08e3596..e046fa6 100644 (file)
@@ -259,6 +259,7 @@ static void in_evdev_probe(const in_drv_t *drv)
 
 no_abs:
                if (count == 0 && !have_abs) {
+                       free(dev->kbits);
                        free(dev);
                        goto skip;
                }
@@ -290,9 +291,13 @@ static void in_evdev_free(void *drv_data)
 }
 
 static const char * const *
-in_evdev_get_key_names(int *count)
+in_evdev_get_key_names(const in_drv_t *drv, int *count)
 {
+       const struct in_pdata *pdata = drv->pdata;
        *count = KEY_CNT;
+
+       if (pdata->key_names)
+               return pdata->key_names;
        return in_evdev_keys;
 }