]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang
authorJim Meyering <meyering@redhat.com>
Wed, 7 Apr 2010 15:23:24 +0000 (17:23 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 14 Apr 2010 18:10:19 +0000 (20:10 +0200)
* src/util/util.c (virGetHostnameLocalhost): Add an sa_assert
to tell clang it's ok to dereference "info" after a non-failing
getaddrinfo call.

src/util/util.c

index 405c5f3d6e2840e32496cf7a8e6e36ac298efb0e..268944da52170eb8370afc3300b25b75f2d265a0 100644 (file)
@@ -2394,6 +2394,9 @@ char *virGetHostnameLocalhost(int allow_localhost)
         return NULL;
     }
 
+    /* Tell static analyzers about getaddrinfo semantics.  */
+    sa_assert (info);
+
     /* if we aren't allowing localhost, then we iterate through the
      * list and make sure none of the IPv4 addresses are 127.0.0.1 and
      * that none of the IPv6 addresses are ::1