• Thomas Haller's avatar
    connectivity: various cleanup in resolve_cb() · 77fbe191
    Thomas Haller authored
    - use cleanup attribute except explicit free/unref.
    
    - check that the result has the expected address family.
      Arguably, it should always, unless there is a bug in systemd-resolved.
      By that reasoning, we also wouldn't have to check the address length
      either.
    
    - don't use strndup() for values that are later freed by g_free().
      We should always agree whether to malloc/free or g_malloc/g_free.
    
    - don't use strcasecmp(). Always use the locale independent g_ascii_strcasecmp()
      instead.
    
    - use nm_utils_inet_ntop() instead of inet_ntop(). It's our preferred
      wrapper, which as a stricter semantic (for example, it cannot fail
      and it's input arguments are stricter defined).
    
    - use nm_clear_g_free() instead of g_clear_pointer().
    77fbe191
nm-connectivity.c 31.4 KB