ok?

Index: net/if_enc.c
===================================================================
RCS file: /cvs/src/sys/net/if_enc.c,v
retrieving revision 1.73
diff -u -p -r1.73 if_enc.c
--- net/if_enc.c        8 Jul 2018 16:41:12 -0000       1.73
+++ net/if_enc.c        10 Jun 2019 16:38:00 -0000
@@ -77,8 +77,7 @@ enc_clone_create(struct if_clone *ifc, i
        if (unit > ENC_MAX_UNITS)
                return (EINVAL);
 
-       if ((sc = malloc(sizeof(struct enc_softc),
-           M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
+       if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
                return (ENOBUFS);
 
        sc->sc_unit = unit;
@@ -131,7 +130,8 @@ enc_clone_create(struct if_clone *ifc, i
                if (enc_allifps != NULL) {
                        memcpy(new, enc_allifps,
                            sizeof(struct ifnet *) * (enc_max_unit + 1));
-                       free(enc_allifps, M_DEVBUF, 0);
+                       free(enc_allifps, M_DEVBUF,
+                           sizeof(struct ifnet *) * (enc_max_unit + 1));
                }
                enc_allifps = new;
                enc_max_unit = unit;
@@ -157,7 +157,7 @@ enc_clone_destroy(struct ifnet *ifp)
        NET_UNLOCK();
 
        if_detach(ifp);
-       free(sc, M_DEVBUF, 0);
+       free(sc, M_DEVBUF, sizeof(*sc));
 
        return (0);
 }

Reply via email to