From f171b04d9e5839e9f8ae52fe34bd46d6d54d3700 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 15 Jan 2011 15:07:45 -0500 Subject: [PATCH] Increase the argument length for a line in an rc file. Plugged a memory leak. --- src/ui.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ui.c b/src/ui.c index e0c75eb..89b3219 100644 --- a/src/ui.c +++ b/src/ui.c @@ -463,7 +463,7 @@ skip_option_stuff: static char **parseargv(char *str, const char *progname, int *me_argc) { char **pptr, *s; - char arg[255]; + char arg[LINE_MAX]; int idx = 0; int quote = 0; int lastchar = 0; @@ -551,8 +551,9 @@ static int parse_rc_file(const char *filename) while ((p = fgets(line, sizeof(line), fp)) != NULL) { char name[PATH_MAX], options[LINE_MAX], tmp[PATH_MAX], *s; int my_argc; - char **my_argv; + char **my_argv, **ap; int lastchar = '\0'; + int n; while (*p && isspace((unsigned char) *p)) p++; @@ -623,8 +624,14 @@ static int parse_rc_file(const char *filename) continue; optind = 0; + n = init_module_options(my_argc, my_argv, mod); - if (init_module_options(my_argc, my_argv, mod)) { + for (ap = my_argv; *ap; ap++) + free(*ap); + + free(my_argv); + + if (n) { fclose(fp); return 2; } -- 2.11.4.GIT