]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cmdPoolDiscoverSources: initialize earlier to avoid FP from clang
authorJim Meyering <meyering@redhat.com>
Mon, 1 Mar 2010 14:41:15 +0000 (15:41 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 1 Mar 2010 15:29:33 +0000 (16:29 +0100)
* tools/virsh.c (cmdPoolDiscoverSources): Always initialize srcSpec.
Otherwise, clang would report that srcSpec could be used uninitialized
in the call to virConnectFindStoragePoolSources.

tools/virsh.c

index 3b1011ccf69533f17b8844b6ff06fff6924d218a..191e7bae6ccfec3a4bcfef3a071bb64ca53102d2 100644 (file)
@@ -4431,17 +4431,16 @@ static const vshCmdOptDef opts_find_storage_pool_sources[] = {
 static int
 cmdPoolDiscoverSources(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
 {
-    char *type, *srcSpec, *srcSpecFile, *srcList;
+    char *type, *srcSpecFile, *srcList;
+    char *srcSpec = NULL;
     int found;
 
     type = vshCommandOptString(cmd, "type", &found);
     if (!found)
         return FALSE;
     srcSpecFile = vshCommandOptString(cmd, "srcSpec", &found);
-    if (!found) {
+    if (!found)
         srcSpecFile = NULL;
-        srcSpec = NULL;
-    }
 
     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
         return FALSE;