extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal(MonoString *iface, MonoArray **gw_addr_list)
{
+ MonoError error;
size_t needed;
in_addr_t in;
int mib[6];
MonoDomain *domain = mono_domain_get ();
- ifacename = mono_string_to_utf8(iface);
+ ifacename = mono_string_to_utf8_checked(iface, &error);
+ if (mono_error_set_pending_exception (&error))
+ return FALSE;
+
if ((ifindex = if_nametoindex(ifacename)) == 0)
return FALSE;
g_free(ifacename);
return FALSE;
// Allocate suffcient memory for available data based on the previous sysctl call
- if ((buf = malloc(needed)) == NULL)
+ if ((buf = g_malloc (needed)) == NULL)
return FALSE;
// Second sysctl call to retrieve data into appropriately sized buffer
mono_array_setref (*gw_addr_list, gwnum, addr_string);
gwnum++;
}
- free(buf);
+ g_free (buf);
return TRUE;
}