Explicitly mark size parameter as (in)
The generated gir file marks the size parameter as "out" by default. This is wrong in the context of a caller allocated buffer with a given size. Explicitly marking the size parameter as (in) fixes the issue.
There is already an issue for this topic from 2 years ago. In the past the issue was solved by adding an explicit annotation, too.