
On 04/14/2010 10:02 AM, Jim Meyering wrote:
From: Jim Meyering <meyering@redhat.com>
* src/util/conf.c (virConfParseValue): Add an sa_assert. --- src/util/conf.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
A little more context makes this obvious: if ((ctxt->cur < ctxt->end) && (CUR != ']')) { if ((lst = virConfParseValue(ctxt)) == NULL) return(NULL);
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); +
Either we never enter the while loop, or the previous if must have been true and lst was assigned. So ACK, if 1/7 is approved. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org