[PATCH 10/30] Fix potential NULL pointer dereference

Zdenek Kabelac <[email protected]>
Newsgroups dev.linux.lists.lvm-devel
Message-ID <0fe6e9c0c86a7a0487fb7a6eead6fc7b4760a123.1287994530.git.zkabelac@redhat.com>
Makes clang happier as it covers all code paths and avoids NULL pointer
dereference through com pointer (which is NULL by default static
initialisation).

Signed-off-by: Zdenek Kabelac <[email protected]>
---
 tools/lvm.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lvm.c b/tools/lvm.c
index 60f9a79..9cac23e 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -85,11 +85,11 @@ static char *_list_args(const char *text, int state)
 				break;
 			}
 		}
-
-		if (!com)
-			return NULL;
 	}
 
+	if (!com)
+		return NULL;
+
 	/* Short form arguments */
 	if (len < 3) {
 		while (match_no < com->num_args) {
-- 
1.7.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.