diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-09-20 01:09:07 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-09-20 01:09:34 +0400 |
commit | b96fbc3f966b012720d2b74b1dfd2a0ab95086cf (patch) | |
tree | 606750874faf65029f756dc0b401ee40cc4da89f /accel-pptpd/ctrl/pptp.c | |
parent | d860a4beaf5f99d5045d03b931b4829426a2f7b0 (diff) | |
download | accel-ppp-xebd-b96fbc3f966b012720d2b74b1dfd2a0ab95086cf.tar.gz accel-ppp-xebd-b96fbc3f966b012720d2b74b1dfd2a0ab95086cf.zip |
fixed many bugs and memory leaks
Diffstat (limited to 'accel-pptpd/ctrl/pptp.c')
-rw-r--r-- | accel-pptpd/ctrl/pptp.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/accel-pptpd/ctrl/pptp.c b/accel-pptpd/ctrl/pptp.c index dab807c..b8bb366 100644 --- a/accel-pptpd/ctrl/pptp.c +++ b/accel-pptpd/ctrl/pptp.c @@ -20,6 +20,8 @@ #include "ppp.h" #include "iprange.h" +#include "memdebug.h" + #define STATE_IDLE 0 #define STATE_ESTB 1 #define STATE_PPP 2 @@ -73,10 +75,13 @@ static void disconnect(struct pptp_conn_t *conn) triton_event_fire(EV_CTRL_FINISHED, &conn->ppp); triton_context_unregister(&conn->ctx); + + if (conn->ppp.chan_name) + _free(conn->ppp.chan_name); - free(conn->in_buf); - free(conn->out_buf); - free(conn); + _free(conn->in_buf); + _free(conn->out_buf); + _free(conn); } static int post_msg(struct pptp_conn_t *conn, void *buf, int size) @@ -265,7 +270,7 @@ static int pptp_out_call_rqst(struct pptp_conn_t *conn) return -1; conn->ppp.fd = pptp_sock; - conn->ppp.chan_name = strdup(inet_ntoa(dst_addr.sa_addr.pptp.sin_addr)); + conn->ppp.chan_name = _strdup(inet_ntoa(dst_addr.sa_addr.pptp.sin_addr)); triton_event_fire(EV_CTRL_STARTED, &conn->ppp); @@ -486,15 +491,15 @@ static int pptp_connect(struct triton_md_handler_t *h) continue; } - conn = malloc(sizeof(*conn)); + conn = _malloc(sizeof(*conn)); memset(conn, 0, sizeof(*conn)); conn->hnd.fd = sock; conn->hnd.read = pptp_read; conn->hnd.write = pptp_write; conn->ctx.close = pptp_close; conn->ctx.before_switch = log_switch; - conn->in_buf = malloc(PPTP_CTRL_SIZE_MAX); - conn->out_buf = malloc(PPTP_CTRL_SIZE_MAX); + conn->in_buf = _malloc(PPTP_CTRL_SIZE_MAX); + conn->out_buf = _malloc(PPTP_CTRL_SIZE_MAX); conn->timeout_timer.expire = pptp_timeout; conn->timeout_timer.period = conf_timeout * 1000; conn->echo_timer.expire = pptp_send_echo; |