Module Name:    src
Committed By:   yamaguchi
Date:           Thu Apr 22 10:26:24 UTC 2021

Modified Files:
        src/sys/net: if_pppoe.c

Log Message:
Added missing free of sc_hunique to prevent memory leak
when using PPPoE server


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/net/if_pppoe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.169 src/sys/net/if_pppoe.c:1.170
--- src/sys/net/if_pppoe.c:1.169	Fri Apr 16 02:23:25 2021
+++ src/sys/net/if_pppoe.c	Thu Apr 22 10:26:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.169 2021/04/16 02:23:25 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.170 2021/04/22 10:26:24 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.169 2021/04/16 02:23:25 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.170 2021/04/22 10:26:24 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -448,6 +448,13 @@ pppoe_clone_destroy(struct ifnet *ifp)
 	callout_halt(&sc->sc_timeout, NULL);
 	callout_destroy(&sc->sc_timeout);
 
+#ifdef PPPOE_SERVER
+	if (sc->sc_hunique) {
+		free(sc->sc_hunique, M_DEVBUF);
+		sc->sc_hunique = NULL;
+		sc->sc_hunique_len = 0;
+	}
+#endif
 	if (sc->sc_concentrator_name)
 		free(sc->sc_concentrator_name, M_DEVBUF);
 	if (sc->sc_service_name)

Reply via email to