diff options
author | Amar Tumballi <amar@gluster.com> | 2010-07-27 11:13:32 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-07-28 03:34:48 -0700 |
commit | 753146c0ff4b1b55892b71b36d6ca97797867aaa (patch) | |
tree | 2e449e2c30f41248c6e533d7dde7dd381166725d /xlators/mgmt/glusterd/src/glusterd-sm.c | |
parent | 0aae2c46579421b871919e93619273d9a9bc79fb (diff) |
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 <amar@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 966 (NULL check for avoiding NULL dereferencing of pointers..)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=966
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index b1a4c0d8a..1ac3f902b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -550,6 +550,8 @@ glusterd_friend_sm () event->peerinfo = peerinfo; } + if (!peerinfo) + goto out; state = glusterd_friend_state_table[peerinfo->state.state]; @@ -573,7 +575,7 @@ glusterd_friend_sm () gf_log ("glusterd", GF_LOG_ERROR, "Unable to transition" "state from %d to %d", peerinfo->state.state, state[event_type].next_state); - return ret; + goto out; } GF_FREE (event); @@ -582,7 +584,7 @@ glusterd_friend_sm () ret = 0; - +out: return ret; } |