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 --- libglusterfs/src/logging.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libglusterfs/src/logging.c') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index d5a38e6b6..000c2ccd3 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -311,6 +311,9 @@ __logfile_for_client (char *identifier) if (!client_logs) { client = GF_CALLOC (1, sizeof (*client), gf_common_mt_client_log); + if (!client) + return NULL; + client_log_init (client, identifier); client_logs = client; @@ -324,6 +327,8 @@ __logfile_for_client (char *identifier) if (!client) { client = GF_CALLOC (1, sizeof (*client), gf_common_mt_client_log); + if (!client) + return NULL; client_log_init (client, identifier); -- cgit