Fix a probably rare and inconsequential memory leak.

Spotted by:	FlexeLint
This commit is contained in:
Poul-Henning Kamp 2002-10-02 20:29:54 +00:00
parent 0b15d9a1b6
commit 42117b6c4d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104386
2 changed files with 6 additions and 2 deletions

View file

@ -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);

View file

@ -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);