Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
return rc;
}
+static void free_uevent(struct uevents *uevent)
+{
+ struct uevents *old;
+ do {
+ old = uevent;
+ uevent = uevent->next;
+ free (old);
+ } while (uevent);
+}
+
struct uevents *read_sysfs_uevents(char *dname)
{
FILE *fp;
if (!next->key) {
perror("next->key");
free(file);
+ free_uevent(uevent);
return NULL;
}
strcpy(next->key, p);
fprintf(stderr, "Error on uevent information\n");
fclose(fp);
free(file);
+ free_uevent(uevent);
return NULL;
}
next->value = malloc(strlen(p) + 1);
if (!next->value) {
perror("next->value");
free(file);
+ free_uevent(uevent);
return NULL;
}
strcpy(next->value, p);
if (!next->next) {
perror("next->next");
free(file);
+ free_uevent(uevent);
return NULL;
}
next = next->next;
}
uevent = uevent->next;
}
+ free_uevent(uevent);
if (debug)
fprintf(stderr, "input device is %s\n", name);