diff --git a/src/libs/compat/freebsd_network/device.c b/src/libs/compat/freebsd_network/device.c index 872a8a082e..fa5d69c572 100644 --- a/src/libs/compat/freebsd_network/device.c +++ b/src/libs/compat/freebsd_network/device.c @@ -198,6 +198,12 @@ device_get_children(device_t dev, device_t **devlistp, int *devcountp) count++; } + if (count == 0) { + *devlistp = NULL; + *devcountp = 0; + return (0); + } + list = malloc(count * sizeof(device_t)); if (!list) return (ENOMEM);