summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-07-19 00:56:18 +0300
committerGitHub <noreply@github.com>2026-07-19 00:56:18 +0300
commit626acba0b8ca5efda607296277392a04f909ff72 (patch)
treee4ac734416ccfd369b48910d3e2d9bfa58e04f6d
parent779c2d0233559bac9e00e1f62d10c13218f90bee (diff)
parente12b38501be622c9c8e030de86a28721d797e542 (diff)
downloadaccel-ppp-626acba0b8ca5efda607296277392a04f909ff72.tar.gz
accel-ppp-626acba0b8ca5efda607296277392a04f909ff72.zip
Merge pull request #331 from nuclearcat/ipoe-leak-fixes
ipoe: fix two memory leaks (relay reply packet, username string)
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 4bf43434..18e9228d 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -783,6 +783,10 @@ static void ipoe_session_start(struct ipoe_session *ses)
return;
}
+ /* take ownership now so the string is freed by ipoe_session_free()
+ * even if the session terminates before auth_result() consumes it */
+ ses->username = username;
+
ses->ses.unit_idx = ses->serv->ifindex;
triton_event_fire(EV_CTRL_STARTING, &ses->ses);
@@ -794,7 +798,6 @@ static void ipoe_session_start(struct ipoe_session *ses)
return;
if (conf_noauth) {
- ses->username = username;
r = PWDB_SUCCESS;
} else {
#ifdef RADIUS
@@ -813,7 +816,6 @@ static void ipoe_session_start(struct ipoe_session *ses)
} else
pass = username;
- ses->username = username;
r = pwdb_check(&ses->ses, (pwdb_callback)auth_result, ses, username, PPP_PAP, pass);
if (r == PWDB_WAIT)
@@ -1242,6 +1244,9 @@ static void ipoe_session_free(struct ipoe_session *ses)
if (ses->l4_redirect_ipset)
_free(ses->l4_redirect_ipset);
+ if (ses->username)
+ _free(ses->username);
+
triton_context_unregister(&ses->ctx);
if (ses->data)
@@ -2030,6 +2035,7 @@ static void ipoe_ses_recv_dhcpv4_relay(struct dhcpv4_packet *pack)
if (!ses->dhcpv4_request) {
ses->dhcpv4_relay_reply = NULL;
+ dhcpv4_packet_free(pack);
return;
}