Hi tech@,

Here is a diff to add sizes for free() in vio(4).

There is an existing allocsize variable tracking size of allocations,
turns out we can pass it to free() in the error path.

Comments? OK?

Index: sys/dev/pv/if_vio.c
===================================================================
RCS file: /cvs/src/sys/dev/pv/if_vio.c,v
retrieving revision 1.14
diff -u -p -r1.14 if_vio.c
--- sys/dev/pv/if_vio.c 25 Oct 2019 07:13:54 -0000      1.14
+++ sys/dev/pv/if_vio.c 18 Dec 2019 14:13:45 -0000
@@ -482,7 +482,7 @@ err_reqs:
                        bus_dmamap_destroy(vsc->sc_dmat, sc->sc_rx_dmamaps[i]);
        }
        if (sc->sc_arrays) {
-               free(sc->sc_arrays, M_DEVBUF, 0);
+               free(sc->sc_arrays, M_DEVBUF, allocsize);
                sc->sc_arrays = 0;
        }
 err_hdr:

Reply via email to