From 753146c0ff4b1b55892b71b36d6ca97797867aaa Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 27 Jul 2010 11:13:32 +0000 Subject: some check added to the variables after GF_CALLOC handles some NULL dereference problems (reported by clang when ran with code where '#define GF_CALLOC NULL'). Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 966 (NULL check for avoiding NULL dereferencing of pointers..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=966 --- glusterfsd/src/glusterfsd.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'glusterfsd/src') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 30057b5db..7fd447880 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -315,6 +315,9 @@ gf_remember_xlator_option (struct list_head *options, char *arg) option = GF_CALLOC (1, sizeof (xlator_cmdline_option_t), gfd_mt_xlator_cmdline_option_t); + if (!option) + goto out; + INIT_LIST_HEAD (&option->cmd_args); dot = strchr (arg, '.'); @@ -331,6 +334,9 @@ gf_remember_xlator_option (struct list_head *options, char *arg) option->key = GF_CALLOC ((equals - dot) + 1, sizeof (char), gfd_mt_char); + if (!option->key) + goto out; + strncpy (option->key, dot + 1, (equals - dot - 1)); if (!*(equals + 1)) -- cgit