From f4c70e659ffb00b8f69da48f3d5a0e5bb540f8cb Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 2 Oct 2002 20:29:54 +0000 Subject: Fix a probably rare and inconsequential memory leak. Spotted by: FlexeLint --- sys/dev/fdc/fdc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/dev/fdc') diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index d67d902..fdd2ca4 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -985,8 +985,10 @@ fdc_add_child(device_t dev, const char *name, int unit) if (resource_int_value(name, unit, "drive", &ivar->fdunit) != 0) ivar->fdunit = 0; child = device_add_child(dev, name, unit); - if (child == NULL) + if (child == NULL) { + free(ivar, M_DEVBUF); return; + } device_set_ivars(child, ivar); if (resource_int_value(name, unit, "flags", &flags) == 0) device_set_flags(child, flags); -- cgit v1.1