From e95fc28b08669e329916e1cf1eb52fa462ad655a Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Tue, 16 Nov 2010 17:19:33 +0300 Subject: log-tcp: fixed incorrect queue overflow handling ppp: fixed memory leak when ipcp raises error at ConfReq --- accel-pptpd/logs/log_tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'accel-pptpd/logs/log_tcp.c') diff --git a/accel-pptpd/logs/log_tcp.c b/accel-pptpd/logs/log_tcp.c index 2579ac2..fdef63e 100644 --- a/accel-pptpd/logs/log_tcp.c +++ b/accel-pptpd/logs/log_tcp.c @@ -111,6 +111,7 @@ static void queue_log(struct tcp_target_t *t, struct log_msg_t *msg) if (t->queue_len == conf_queue_len) { spin_unlock(&t->lock); log_free_msg(msg); + return; } list_add_tail(&msg->entry, &t->queue); t->queue_len++; @@ -182,7 +183,8 @@ static int log_tcp_connect(struct triton_md_handler_t *h) t->wait = 1; spin_unlock(&t->lock); - send_log(t); + if (send_log(t)) + triton_md_enable_handler(&t->hnd, MD_MODE_WRITE); return 0; } @@ -258,6 +260,8 @@ static int start_log(const char *_opt) INIT_LIST_HEAD(&t->queue); + spinlock_init(&t->lock); + start_connect(t); log_register_target(&t->target); -- cgit v1.2.3