[libvirt] [PATCH 6/7] xend_internal.c: assure clang that we do not dereference NULL

Jim Meyering jim at meyering.net
Wed Apr 14 16:02:35 UTC 2010


From: Jim Meyering <meyering at redhat.com>

* src/xen/xend_internal.c (xend_parse_sexp_desc_char): Add three
uses of sa_assert, each preceding a strchr(value,... to assure
clang that "value" is non-NULL.
---
 src/xen/xend_internal.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index c4e73b7..950f1b5 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1284,6 +1284,7 @@ xend_parse_sexp_desc_char(virBufferPtr buf,
         virBufferVSprintf(buf, "      <source path='%s'/>\n",
                           value);
     } else if (STREQ(type, "tcp")) {
+        sa_assert (value);
         const char *offset = strchr(value, ':');
         const char *offset2;
         const char *mode, *protocol;
@@ -1325,6 +1326,7 @@ xend_parse_sexp_desc_char(virBufferPtr buf,
                           "      <protocol type='%s'/>\n",
                           protocol);
     } else if (STREQ(type, "udp")) {
+        sa_assert (value);
         const char *offset = strchr(value, ':');
         const char *offset2, *offset3;

@@ -1383,6 +1385,7 @@ xend_parse_sexp_desc_char(virBufferPtr buf,
         }

     } else if (STREQ(type, "unix")) {
+        sa_assert (value);
         const char *offset = strchr(value, ',');
         int dolisten = 0;
         if (offset)
-- 
1.7.1.rc1.248.gcefbb




More information about the libvir-list mailing list