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

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



Make sure we have *c defined.
clang seems to be happier with this check.

Signed-off-by: Zdenek Kabelac <zkabelac redhat com>
---
 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


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