summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-11-05 16:30:06 +1100
committerDamien Miller <djm@mindrot.org>2008-11-05 16:30:06 +1100
commit1a0442fce894dc09c50d882d9d19f8ed95977a3f (patch)
treeed2c6c31b41bbada49bde934fc97ecd3cab284d8 /readconf.c
parent01ed2272a1545336173bf3aef66fbccc3494c8d8 (diff)
- stevesk@cvs.openbsd.org 2008/11/04 19:18:00
[readconf.c] because parse_forward() is now used to parse all forward types (DLR), and it malloc's space for host variables, we don't need to malloc here. fixes small memory leaks. previously dynamic forwards were not parsed in parse_forward() and space was not malloc'd in that case. ok djm@
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/readconf.c b/readconf.c
index ba70d9da0..d1ffd84a8 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.171 2008/11/04 08:22:13 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.172 2008/11/04 19:18:00 stevesk Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -256,10 +256,9 @@ add_local_forward(Options *options, const Forward *newfwd)
256 fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION); 256 fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION);
257 fwd = &options->local_forwards[options->num_local_forwards++]; 257 fwd = &options->local_forwards[options->num_local_forwards++];
258 258
259 fwd->listen_host = (newfwd->listen_host == NULL) ? 259 fwd->listen_host = newfwd->listen_host;
260 NULL : xstrdup(newfwd->listen_host);
261 fwd->listen_port = newfwd->listen_port; 260 fwd->listen_port = newfwd->listen_port;
262 fwd->connect_host = xstrdup(newfwd->connect_host); 261 fwd->connect_host = newfwd->connect_host;
263 fwd->connect_port = newfwd->connect_port; 262 fwd->connect_port = newfwd->connect_port;
264} 263}
265 264
@@ -277,10 +276,9 @@ add_remote_forward(Options *options, const Forward *newfwd)
277 SSH_MAX_FORWARDS_PER_DIRECTION); 276 SSH_MAX_FORWARDS_PER_DIRECTION);
278 fwd = &options->remote_forwards[options->num_remote_forwards++]; 277 fwd = &options->remote_forwards[options->num_remote_forwards++];
279 278
280 fwd->listen_host = (newfwd->listen_host == NULL) ? 279 fwd->listen_host = newfwd->listen_host;
281 NULL : xstrdup(newfwd->listen_host);
282 fwd->listen_port = newfwd->listen_port; 280 fwd->listen_port = newfwd->listen_port;
283 fwd->connect_host = xstrdup(newfwd->connect_host); 281 fwd->connect_host = newfwd->connect_host;
284 fwd->connect_port = newfwd->connect_port; 282 fwd->connect_port = newfwd->connect_port;
285} 283}
286 284