Make sure we don't free memory that's already been freed by setting

the geom->softc pounter to NULL before freeing the g_slicer softc.
In g_slicer_free() the pointer is checked first.

Obtained from:	Juniper Networks, Inc.
This commit is contained in:
Marcel Moolenaar 2014-04-06 02:20:42 +00:00
parent 2d1e88da97
commit 12b2d77da9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264184

View File

@ -534,11 +534,14 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co
void
g_slice_orphan(struct g_consumer *cp)
{
struct g_slicer *gsp;
g_trace(G_T_TOPOLOGY, "g_slice_orphan(%p/%s)", cp, cp->provider->name);
g_topology_assert();
/* XXX: Not good enough we leak the softc and its suballocations */
g_slice_free(cp->geom->softc);
gsp = cp->geom->softc;
cp->geom->softc = NULL;
g_slice_free(gsp);
g_wither_geom(cp->geom, ENXIO);
}