[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@
This commit is contained in:
Damien Miller 2008-11-05 16:30:06 +11:00
parent 01ed2272a1
commit 1a0442fce8
2 changed files with 16 additions and 8 deletions

View File

@ -26,6 +26,16 @@
compiled-time disabled (turn on -DJPAKE in Makefile.inc). compiled-time disabled (turn on -DJPAKE in Makefile.inc).
"just commit it. It isn't too intrusive." deraadt@ "just commit it. It isn't too intrusive." deraadt@
- 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@
20081103 20081103
- OpenBSD CVS Sync - OpenBSD CVS Sync
@ -4876,4 +4886,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.5130 2008/11/05 05:20:46 djm Exp $ $Id: ChangeLog,v 1.5131 2008/11/05 05:30:06 djm Exp $

View File

@ -1,4 +1,4 @@
/* $OpenBSD: readconf.c,v 1.171 2008/11/04 08:22:13 djm Exp $ */ /* $OpenBSD: readconf.c,v 1.172 2008/11/04 19:18:00 stevesk Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -256,10 +256,9 @@ add_local_forward(Options *options, const Forward *newfwd)
fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION); fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION);
fwd = &options->local_forwards[options->num_local_forwards++]; fwd = &options->local_forwards[options->num_local_forwards++];
fwd->listen_host = (newfwd->listen_host == NULL) ? fwd->listen_host = newfwd->listen_host;
NULL : xstrdup(newfwd->listen_host);
fwd->listen_port = newfwd->listen_port; fwd->listen_port = newfwd->listen_port;
fwd->connect_host = xstrdup(newfwd->connect_host); fwd->connect_host = newfwd->connect_host;
fwd->connect_port = newfwd->connect_port; fwd->connect_port = newfwd->connect_port;
} }
@ -277,10 +276,9 @@ add_remote_forward(Options *options, const Forward *newfwd)
SSH_MAX_FORWARDS_PER_DIRECTION); SSH_MAX_FORWARDS_PER_DIRECTION);
fwd = &options->remote_forwards[options->num_remote_forwards++]; fwd = &options->remote_forwards[options->num_remote_forwards++];
fwd->listen_host = (newfwd->listen_host == NULL) ? fwd->listen_host = newfwd->listen_host;
NULL : xstrdup(newfwd->listen_host);
fwd->listen_port = newfwd->listen_port; fwd->listen_port = newfwd->listen_port;
fwd->connect_host = xstrdup(newfwd->connect_host); fwd->connect_host = newfwd->connect_host;
fwd->connect_port = newfwd->connect_port; fwd->connect_port = newfwd->connect_port;
} }