Skip to content

gwin32networkmonitor: Fix returning address of local variable

Something has changed recently which causes this error to now be emitted when building on Windows msys2-mingw32:

../gio/gwin32networkmonitor.c: In function 'win_network_monitor_get_ip_info':
../gio/gwin32networkmonitor.c:92:15: error: storing the address of local variable 'prefix' in '*dest' [-Werror=dangling-pointer=]
   92 |         *dest = (guint8 *) &prefix.Prefix.Ipv4.sin_addr;
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If IP_ADDRESS_PREFIX is defined as a scalar rather than a pointer, that could explain the problem.

Change the function to always operate on a pointer to avoid any potential such issues.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Merge request reports

Loading