aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2017-09-09 20:11:47 -0700
committerAndreas Schneider <asn@cryptomilk.org>2017-09-11 16:26:41 +0200
commit1c9eb4dfb9dfe477ce4f879949e5d5ba02ecb646 (patch)
treed7836e851efce6afa320181a7602ff79edcd2a2d /src
parent94fa1e382f1258c8f782380e3de12260aa4e9b96 (diff)
downloadlibssh-1c9eb4dfb9dfe477ce4f879949e5d5ba02ecb646.tar.gz
libssh-1c9eb4dfb9dfe477ce4f879949e5d5ba02ecb646.tar.xz
libssh-1c9eb4dfb9dfe477ce4f879949e5d5ba02ecb646.zip
config: fix memory leak with repeated opcodes
Fix a memory leak in the path where parsing returns early due to seeing a repeated opcode. A testcase is added which demonstrates the leak and fix with valgrind. Resolves CID 1374267. Signed-off-by: Jon Simons <jon@jonsimons.org>
Diffstat (limited to 'src')
-rw-r--r--src/config.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 42148df7..25d64998 100644
--- a/src/config.c
+++ b/src/config.c
@@ -251,6 +251,7 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
opcode = ssh_config_get_opcode(keyword);
if (*parsing == 1 && opcode != SOC_HOST && opcode != SOC_UNSUPPORTED && opcode != SOC_INCLUDE) {
if (seen[opcode] != 0) {
+ SAFE_FREE(x);
return 0;
}
seen[opcode] = 1;