From bbf5dd7221e8297a95a1b3d7b3937782ea7ca5d4 Mon Sep 17 00:00:00 2001 From: Steven Luo Date: Thu, 26 Aug 2010 04:43:15 -0700 Subject: [PATCH] Fix memory leak when repeated options are encountered in config file Caught by valgrind. --- config.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.c b/config.c index 8928a3d..395bcf2 100644 --- a/config.c +++ b/config.c @@ -119,6 +119,10 @@ static int swb_config_load_option(struct swb_config *cfg, break; } cfg->flags |= opt->set_mask; + } else { + /* Option was repeated in the config file + We want the first value, so ignore this one */ + free(value); } retval = 1; break; -- 1.7.9.5