diff options
author | kn <kn@cvs.openbsd.org> | 2020-09-12 13:44:39 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2020-09-12 13:44:39 +0000 |
commit | 357d8daf273b1fcd4f6bd078f771801d49f15360 (patch) | |
tree | bb005901c2c99e2b8a9e5de7eda59bfe6837a79c | |
parent | 84b2dbc3a4503e51cd55e759c45ddb8bf0208a39 (diff) |
Add sizes to free() calls
These are the last ones in if_pppoe.c and if_spppsubr.c.
OK beck
-rw-r--r-- | sys/net/if_spppsubr.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index bda2068fcc2..ac1dc9a709d 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.186 2020/08/22 16:12:12 kn Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.187 2020/09/12 13:44:38 kn Exp $ */ /* * Synchronous PPP link level subroutines. * @@ -750,13 +750,15 @@ sppp_detach(struct ifnet *ifp) /* release authentication data */ if (sp->myauth.name != NULL) - free(sp->myauth.name, M_DEVBUF, 0); + free(sp->myauth.name, M_DEVBUF, strlen(sp->myauth.name) + 1); if (sp->myauth.secret != NULL) - free(sp->myauth.secret, M_DEVBUF, 0); + free(sp->myauth.secret, M_DEVBUF, + strlen(sp->myauth.secret) + 1); if (sp->hisauth.name != NULL) - free(sp->hisauth.name, M_DEVBUF, 0); + free(sp->hisauth.name, M_DEVBUF, strlen(sp->hisauth.name) + 1); if (sp->hisauth.secret != NULL) - free(sp->hisauth.secret, M_DEVBUF, 0); + free(sp->hisauth.secret, M_DEVBUF, + strlen(sp->hisauth.secret) + 1); } /* @@ -4579,9 +4581,11 @@ sppp_set_params(struct sppp *sp, struct ifreq *ifr) if (spa->proto == 0) { /* resetting auth */ if (auth->name != NULL) - free(auth->name, M_DEVBUF, 0); + free(auth->name, M_DEVBUF, + strlen(auth->name) + 1); if (auth->secret != NULL) - free(auth->secret, M_DEVBUF, 0); + free(auth->secret, M_DEVBUF, + strlen(auth->secret) + 1); bzero(auth, sizeof *auth); explicit_bzero(sp->chap_challenge, sizeof sp->chap_challenge); } else { @@ -4594,7 +4598,8 @@ sppp_set_params(struct sppp *sp, struct ifreq *ifr) p = malloc(len, M_DEVBUF, M_WAITOK); strlcpy(p, spa->name, len); if (auth->name != NULL) - free(auth->name, M_DEVBUF, 0); + free(auth->name, M_DEVBUF, + strlen(auth->name) + 1); auth->name = p; if (spa->secret[0] != '\0') { @@ -4603,7 +4608,8 @@ sppp_set_params(struct sppp *sp, struct ifreq *ifr) p = malloc(len, M_DEVBUF, M_WAITOK); strlcpy(p, spa->secret, len); if (auth->secret != NULL) - free(auth->secret, M_DEVBUF, 0); + free(auth->secret, M_DEVBUF, + strlen(auth->secret) + 1); auth->secret = p; } else if (!auth->secret) { p = malloc(1, M_DEVBUF, M_WAITOK); |