Document that the returned pointer should be freed even if the number

of items returned is 0.
This commit is contained in:
njl 2005-05-20 05:04:22 +00:00
parent d8af4c8b76
commit 9ab8d98ce5
3 changed files with 10 additions and 4 deletions

View File

@ -28,7 +28,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd June 16, 1998 .Dd May 19, 2005
.Dt DEVCLASS_GET_DEVICES 9 .Dt DEVCLASS_GET_DEVICES 9
.Os .Os
.Sh NAME .Sh NAME
@ -46,7 +46,10 @@ return the list in
and the count in and the count in
.Fa *devcountp . .Fa *devcountp .
The memory allocated for the list should be freed using The memory allocated for the list should be freed using
.Fn free "*devlistp" "M_TEMP" . .Fn free "*devlistp" "M_TEMP" ,
even if
.Fa *devcountp
is 0.
.Sh RETURN VALUES .Sh RETURN VALUES
Zero is returned on success, otherwise an appropriate error is returned. Zero is returned on success, otherwise an appropriate error is returned.
.Sh SEE ALSO .Sh SEE ALSO

View File

@ -28,7 +28,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd April 3, 2005 .Dd May 19, 2005
.Dt DEVCLASS_GET_DRIVERS 9 .Dt DEVCLASS_GET_DRIVERS 9
.Os .Os
.Sh NAME .Sh NAME
@ -47,6 +47,9 @@ and the number of drivers in the list in
.Fa *countp . .Fa *countp .
The memory allocated for the list should be freed using The memory allocated for the list should be freed using
.Fn free "*listp" "M_TEMP" . .Fn free "*listp" "M_TEMP" .
even if
.Fa *countp
is 0.
.Sh RETURN VALUES .Sh RETURN VALUES
Zero is returned on success, otherwise an appropriate error is returned. Zero is returned on success, otherwise an appropriate error is returned.
.Sh SEE ALSO .Sh SEE ALSO

View File

@ -1098,7 +1098,7 @@ devclass_get_softc(devclass_t dc, int unit)
* An array containing a list of all the devices in the given devclass * An array containing a list of all the devices in the given devclass
* is allocated and returned in @p *devlistp. The number of devices * is allocated and returned in @p *devlistp. The number of devices
* in the array is returned in @p *devcountp. The caller should free * in the array is returned in @p *devcountp. The caller should free
* the array using @c free(p, M_TEMP). * the array using @c free(p, M_TEMP), even if @p *devcountp is 0.
* *
* @param dc the devclass to examine * @param dc the devclass to examine
* @param devlistp points at location for array pointer return * @param devlistp points at location for array pointer return