[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] nwfilter_conf.c: don't test an uninitialized local variable



I've just run the code through clang, and it spotted a few new problems.
Here's one:

>From 4c848787c8268e37db9a1d0754b8fcd8e5774f73 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Mon, 29 Mar 2010 17:34:32 +0200
Subject: [PATCH] nwfilter_conf.c: don't test an uninitialized local variable

* src/conf/nwfilter_conf.c (virNWIPAddressFormat): Do not use "i"
uninitialized.
---
 src/conf/nwfilter_conf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index e82aae6..f673e69 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2423,7 +2423,7 @@ virNWIPAddressFormat(virBufferPtr buf, nwIPAddressPtr ipaddr)
                           ipaddr->addr.ipv4Addr[2],
                           ipaddr->addr.ipv4Addr[3]);
     } else {
-        int i;
+        unsigned int i = 0;
         int dcshown = 0, in_dc = 0;
         unsigned short n;
         while (i < 8) {
--
1.7.0.3.448.g82eeb


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]