[libvirt] [PATCH 4/7] virGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang
Eric Blake
eblake at redhat.com
Wed Apr 14 16:39:28 UTC 2010
On 04/14/2010 10:02 AM, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
>
> * 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 | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/src/util/util.c b/src/util/util.c
> index 405c5f3..268944d 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);
> +
ACK if 1/7 goes through, and thanks for the comment explaining why.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100414/a107824f/attachment-0001.sig>
More information about the libvir-list
mailing list