mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 10:14:55 +00:00
Fix a probably rare and inconsequential memory leak.
Spotted by: FlexeLint
This commit is contained in:
parent
0b15d9a1b6
commit
42117b6c4d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104386
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue