[PATCH 4/5] Fix theoretical usage of NULL pointer dereference

Zdenek Kabelac <[email protected]>
Newsgroups dev.linux.lists.lvm-devel
Message-ID <a1cfd7e4e519a821b545e3a299eb01866ed76877.1288097372.git.zkabelac@redhat.com>
Make sure we have *c defined.
clang seems to be happier with this check.

Signed-off-by: Zdenek Kabelac <[email protected]>
---
 libdm/regex/ttree.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libdm/regex/ttree.c b/libdm/regex/ttree.c
index ec97c98..a384c59 100644
--- a/libdm/regex/ttree.c
+++ b/libdm/regex/ttree.c
@@ -97,6 +97,12 @@ int ttree_insert(struct ttree *tt, unsigned int *key, void *data)
 			}
 		}
 	}
+
+	if (!*c) {
+		log_error(INTERNAL_ERROR "Insert failed.");
+		return 0;
+	}
+
 	(*c)->data = data;
 
 	return 1;
-- 
1.7.3.2
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.