From 18887f204e743891b470e1d119f5f2f5efd1a3bd Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 30 Jun 2015 16:58:18 +0300 Subject: [PATCH] estate: make clone_estate() take a NULL pointer Sometimes it is useful to clone a NULL estate (which just returns a NULL as well). I don't do this in current code but I will in future code. Signed-off-by: Dan Carpenter --- smatch_estate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smatch_estate.c b/smatch_estate.c index 035c239d..0e7aff1e 100644 --- a/smatch_estate.c +++ b/smatch_estate.c @@ -258,6 +258,9 @@ struct smatch_state *clone_estate(struct smatch_state *state) { struct smatch_state *ret; + if (!state) + return NULL; + ret = __alloc_smatch_state(0); ret->name = state->name; ret->data = clone_dinfo(get_dinfo(state)); -- 2.11.4.GIT