- djm@cvs.openbsd.org 2008/06/12 15:19:17
[clientloop.h channels.h clientloop.c channels.c mux.c] The multiplexing escape char handler commit last night introduced a small memory leak per session; plug it.
This commit is contained in:
parent
4b3b9773ec
commit
84c56f536c
|
@ -108,6 +108,10 @@
|
|||
We already mark the start of the worm, now also mark the end of the worm
|
||||
in our random art drawings.
|
||||
ok djm@
|
||||
- djm@cvs.openbsd.org 2008/06/12 15:19:17
|
||||
[clientloop.h channels.h clientloop.c channels.c mux.c]
|
||||
The multiplexing escape char handler commit last night introduced a
|
||||
small memory leak per session; plug it.
|
||||
|
||||
20080611
|
||||
- (djm) [channels.c configure.ac]
|
||||
|
@ -4270,4 +4274,4 @@
|
|||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||
|
||||
$Id: ChangeLog,v 1.4983 2008/06/12 18:55:10 dtucker Exp $
|
||||
$Id: ChangeLog,v 1.4984 2008/06/12 18:55:46 dtucker Exp $
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: channels.c,v 1.279 2008/06/12 03:40:52 djm Exp $ */
|
||||
/* $OpenBSD: channels.c,v 1.280 2008/06/12 15:19:17 djm Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -328,6 +328,8 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
|||
c->open_confirm_ctx = NULL;
|
||||
c->input_filter = NULL;
|
||||
c->output_filter = NULL;
|
||||
c->filter_ctx = NULL;
|
||||
c->filter_cleanup = NULL;
|
||||
TAILQ_INIT(&c->status_confirms);
|
||||
debug("channel %d: new [%s]", found, remote_name);
|
||||
return c;
|
||||
|
@ -416,6 +418,8 @@ channel_free(Channel *c)
|
|||
bzero(cc, sizeof(*cc));
|
||||
xfree(cc);
|
||||
}
|
||||
if (c->filter_cleanup != NULL && c->filter_ctx != NULL)
|
||||
c->filter_cleanup(c->self, c->filter_ctx);
|
||||
channels[c->self] = NULL;
|
||||
xfree(c);
|
||||
}
|
||||
|
@ -731,7 +735,7 @@ channel_cancel_cleanup(int id)
|
|||
|
||||
void
|
||||
channel_register_filter(int id, channel_infilter_fn *ifn,
|
||||
channel_outfilter_fn *ofn, void *ctx)
|
||||
channel_outfilter_fn *ofn, channel_filter_cleanup_fn *cfn, void *ctx)
|
||||
{
|
||||
Channel *c = channel_lookup(id);
|
||||
|
||||
|
@ -742,6 +746,7 @@ channel_register_filter(int id, channel_infilter_fn *ifn,
|
|||
c->input_filter = ifn;
|
||||
c->output_filter = ofn;
|
||||
c->filter_ctx = ctx;
|
||||
c->filter_cleanup = cfn;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: channels.h,v 1.94 2008/06/12 03:40:52 djm Exp $ */
|
||||
/* $OpenBSD: channels.h,v 1.95 2008/06/12 15:19:17 djm Exp $ */
|
||||
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
|
@ -62,6 +62,7 @@ typedef struct Channel Channel;
|
|||
|
||||
typedef void channel_callback_fn(int, void *);
|
||||
typedef int channel_infilter_fn(struct Channel *, char *, int);
|
||||
typedef void channel_filter_cleanup_fn(int, void *);
|
||||
typedef u_char *channel_outfilter_fn(struct Channel *, u_char **, u_int *);
|
||||
|
||||
/* Channel success/failure callbacks */
|
||||
|
@ -132,6 +133,7 @@ struct Channel {
|
|||
channel_infilter_fn *input_filter;
|
||||
channel_outfilter_fn *output_filter;
|
||||
void *filter_ctx;
|
||||
channel_filter_cleanup_fn *filter_cleanup;
|
||||
|
||||
/* keep boundaries */
|
||||
int datagram;
|
||||
|
@ -196,7 +198,7 @@ void channel_request_start(int, char *, int);
|
|||
void channel_register_cleanup(int, channel_callback_fn *, int);
|
||||
void channel_register_open_confirm(int, channel_callback_fn *, void *);
|
||||
void channel_register_filter(int, channel_infilter_fn *,
|
||||
channel_outfilter_fn *, void *);
|
||||
channel_outfilter_fn *, channel_filter_cleanup_fn *, void *);
|
||||
void channel_register_status_confirm(int, channel_confirm_cb *,
|
||||
channel_confirm_abandon_cb *, void *);
|
||||
void channel_cancel_cleanup(int);
|
||||
|
|
10
clientloop.c
10
clientloop.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: clientloop.c,v 1.197 2008/06/12 04:17:47 djm Exp $ */
|
||||
/* $OpenBSD: clientloop.c,v 1.198 2008/06/12 15:19:17 djm Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -1260,6 +1260,13 @@ client_new_escape_filter_ctx(int escape_char)
|
|||
return (void *)ret;
|
||||
}
|
||||
|
||||
/* Free the escape filter context on channel free */
|
||||
void
|
||||
client_filter_cleanup(int cid, void *ctx)
|
||||
{
|
||||
xfree(ctx);
|
||||
}
|
||||
|
||||
int
|
||||
client_simple_escape_filter(Channel *c, char *buf, int len)
|
||||
{
|
||||
|
@ -1357,6 +1364,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
|
|||
if (escape_char_arg != SSH_ESCAPECHAR_NONE)
|
||||
channel_register_filter(session_ident,
|
||||
client_simple_escape_filter, NULL,
|
||||
client_filter_cleanup,
|
||||
client_new_escape_filter_ctx(escape_char_arg));
|
||||
if (session_ident != -1)
|
||||
channel_register_cleanup(session_ident,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: clientloop.h,v 1.21 2008/06/12 04:06:00 djm Exp $ */
|
||||
/* $OpenBSD: clientloop.h,v 1.22 2008/06/12 15:19:17 djm Exp $ */
|
||||
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
|
@ -48,6 +48,7 @@ int client_request_tun_fwd(int, int, int);
|
|||
|
||||
/* Escape filter for protocol 2 sessions */
|
||||
void *client_new_escape_filter_ctx(int);
|
||||
void client_filter_cleanup(int, void *);
|
||||
int client_simple_escape_filter(Channel *, char *, int);
|
||||
|
||||
/* Global request confirmation callbacks */
|
||||
|
|
3
mux.c
3
mux.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: mux.c,v 1.3 2008/06/12 05:32:30 djm Exp $ */
|
||||
/* $OpenBSD: mux.c,v 1.4 2008/06/12 15:19:17 djm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
|
||||
*
|
||||
|
@ -436,6 +436,7 @@ muxserver_accept_control(void)
|
|||
if (cctx->want_tty && escape_char != 0xffffffff) {
|
||||
channel_register_filter(c->self,
|
||||
client_simple_escape_filter, NULL,
|
||||
client_filter_cleanup,
|
||||
client_new_escape_filter_ctx((int)escape_char));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue