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: Fix a memory allocation trouble Author: Mauro Carvalho Chehab <mche...@redhat.com> Date: Sun Mar 21 17:13:02 2010 -0300 Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com> utils/keytable/keytable.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=479a129f4aa305243107be1eb78c2a6aa55b9929 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 4484437..880d716 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -101,6 +101,9 @@ static error_t parse_keyfile(char *fname, char **table, char **type) int value, line = 0; char *scancode, *keycode, s[2048]; + *table = NULL; + *type = NULL; + if (debug) fprintf(stderr, "Parsing %s keycode file\n", fname); @@ -120,11 +123,11 @@ static error_t parse_keyfile(char *fname, char **table, char **type) do { if (!strcmp(p, "table")) { p = strtok(NULL,"\n, "); - *table = malloc(sizeof(p) + 1); + *table = malloc(strlen(p) + 1); strcpy(*table, p); } else if (!strcmp(p, "type")) { p = strtok(NULL,"\n, "); - *type = malloc(sizeof(p) + 1); + *type = malloc(strlen(p) + 1); strcpy(*type, p); } else { goto err_einval; @@ -164,7 +167,7 @@ static error_t parse_keyfile(char *fname, char **table, char **type) nextkey->codes[0] = (unsigned) strtol(scancode, NULL, 0); nextkey->codes[1] = (unsigned) value; - nextkey->next = calloc(1, sizeof(keys)); + nextkey->next = calloc(1, sizeof(*nextkey)); if (!nextkey->next) { perror("No memory"); return ENOMEM; _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits