]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang
authorJim Meyering <meyering@redhat.com>
Wed, 7 Apr 2010 18:54:50 +0000 (20:54 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 14 Apr 2010 18:10:19 +0000 (20:10 +0200)
* src/util/conf.c (virConfParseValue): Add an sa_assert.

src/util/conf.c

index ae0459eb372532d88cc6eb452bd1d754710f7bcd..38eb163cdac2c5fab3dc6665a430c08a7752b637 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * conf.c: parser for a subset of the Python encoded Xen configuration files
  *
- * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -473,6 +473,13 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
             SKIP_BLANKS_AND_EOL;
         }
         while ((ctxt->cur < ctxt->end) && (CUR != ']')) {
+
+            /* Tell Clang that when execution reaches this point
+               "lst" is guaranteed to be non-NULL.  This stops it
+               from issuing an invalid NULL-dereference warning about
+               "prev = lst; while (prev->next..." below.  */
+            sa_assert (lst);
+
             if (CUR != ',') {
                 virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
                              _("expecting a separator in list"));