This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: keytable: free uevent struct after usage
Author:  Mauro Carvalho Chehab <mche...@redhat.com>
Date:    Sat Mar 13 00:30:49 2010 -0300

Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>

 utils/keytable/keytable.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=cffa84f0a7aaf0ae5a9d6cd5cae71fc4ecbbacfc

diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index bb512ef..6593727 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -252,6 +252,16 @@ static int seek_sysfs_dir(char *dname, char *node_name, 
char **node_entry)
        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;
@@ -282,6 +292,7 @@ struct uevents *read_sysfs_uevents(char *dname)
                if (!next->key) {
                        perror("next->key");
                        free(file);
+                       free_uevent(uevent);
                        return NULL;
                }
                strcpy(next->key, p);
@@ -291,12 +302,14 @@ struct uevents *read_sysfs_uevents(char *dname)
                        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);
@@ -308,6 +321,7 @@ struct uevents *read_sysfs_uevents(char *dname)
                if (!next->next) {
                        perror("next->next");
                        free(file);
+                       free_uevent(uevent);
                        return NULL;
                }
                next = next->next;
@@ -362,6 +376,7 @@ static char *find_device(void)
                }
                uevent = uevent->next;
        }
+       free_uevent(uevent);
 
        if (debug)
                fprintf(stderr, "input device is %s\n", name);

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to