From: Jim Meyering Date: Wed, 7 Apr 2010 15:23:24 +0000 (+0200) Subject: virGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang X-Git-Tag: v0.8.1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e2f811443ff228d59c8d5f21e5b569d1cf36c58;p=thirdparty%2Flibvirt.git virGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang * src/util/util.c (virGetHostnameLocalhost): Add an sa_assert to tell clang it's ok to dereference "info" after a non-failing getaddrinfo call. --- diff --git a/src/util/util.c b/src/util/util.c index 405c5f3d6e..268944da52 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -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