From e6464f0cb6c36bf047a1dbdbf5cd313ff4fd2dbf Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 13 Jan 2014 23:01:42 -0500 Subject: pacman.c: free string commandline options Plugs a memory leak when values were passed twice. Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- src/pacman/pacman.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/pacman') diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 1fb447c6..748bc546 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -443,9 +443,11 @@ static int parsearg_global(int opt) config->noprogressbar = 1; break; case OP_GPGDIR: + free(config->gpgdir); config->gpgdir = strdup(optarg); break; case OP_LOGFILE: + free(config->logfile); config->logfile = strndup(optarg, PATH_MAX); break; case OP_NOCONFIRM: @@ -453,10 +455,12 @@ static int parsearg_global(int opt) break; case OP_DBPATH: case 'b': + free(config->dbpath); config->dbpath = strdup(optarg); break; case OP_ROOT: case 'r': + free(config->rootdir); config->rootdir = strdup(optarg); break; case OP_VERBOSE: @@ -623,6 +627,7 @@ static int parsearg_trans(int opt) break; case OP_PRINTFORMAT: config->print = 1; + free(config->print_format); config->print_format = strdup(optarg); break; default: -- cgit v1.2.3-70-g09d2