summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Cachereul <f.cachereul@alphalink.fr>2014-10-29 09:30:36 +0100
committerDmitry Kozlov <xeb@mail.ru>2014-10-29 12:10:43 +0300
commitcc796b92272d5ce9c90da2021d877e2e4d7e6a4b (patch)
tree7ee633b730ffbcb95188817afee78fcf9c6760a2
parent4d6d7d53831e289f24e3b54fb2ead6545d8055e3 (diff)
downloadaccel-ppp-cc796b92272d5ce9c90da2021d877e2e4d7e6a4b.tar.gz
accel-ppp-cc796b92272d5ce9c90da2021d877e2e4d7e6a4b.zip
ppp: improve establish_ppp() exit on error
Signed-off-by: François Cachereul <f.cachereul@alphalink.fr> Signed-off-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
-rw-r--r--accel-pppd/ppp/ppp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c
index 7113673..9772b84 100644
--- a/accel-pppd/ppp/ppp.c
+++ b/accel-pppd/ppp/ppp.c
@@ -166,7 +166,7 @@ int __export establish_ppp(struct ppp_t *ppp)
log_ppp_debug("ppp established\n");
if (ap_session_starting(&ppp->ses))
- goto exit_close_unit;
+ goto exit_free_buf;
triton_md_register_handler(ppp->ses.ctrl->ctx, &ppp->chan_hnd);
triton_md_register_handler(ppp->ses.ctrl->ctx, &ppp->unit_hnd);
@@ -178,14 +178,14 @@ int __export establish_ppp(struct ppp_t *ppp)
return 0;
+exit_free_buf:
+ mempool_free(ppp->buf);
+ ppp->buf = NULL;
exit_close_unit:
close(ppp->unit_fd);
exit_close_chan:
close(ppp->chan_fd);
- if (ppp->buf)
- mempool_free(ppp->buf);
-
return -1;
}