nvidia-smi --query-gpu spins forever on FreeBSD head (amd64)

For example

nvidia-smi --format=csv,noheader --query-gpu=temperature.gpu

but the query can really be anything valid.
The command just sits there consuming 100% of a core without reporting anything or terminating.
The command comes with 384.90 driver in FreeBSD packages.
Its source code is not available, of course, but from libc calls I can tell that it is calling strcmp all the time and also strtok_r and malloc.

In addition to “eating” the CPU, it also consumes more and more of memory before getting killed when out of memory.
Looks like an infinite loop related to string parsing (strtok_r, strcmp).