diff options
| author | Jose A. Rivera <jarrpa@redhat.com> | 2014-02-05 08:50:30 -0600 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-02-14 07:10:59 -0800 | 
| commit | 5f0a857c70863eb685ac03d4183502d3bd460b7c (patch) | |
| tree | 26f81001565869ab407050d281f8742b114e6a7a /api/src/glfs.c | |
| parent | db95a98527caf1b5a52ef49e537d0ee575a9bc61 (diff) | |
libgfapi: Add proper NULL checks
Two spots check for NULL after the pointer in question has already been
dereferenced. Checked for NULL (and set errno when needed) at appripriate
spots, added a few NULL checks further up the stack, and some whitespace
cleanup.
BUG: 789278
CID: 1124800
CID: 1124805
Change-Id: I1dd4ad3f285cca36f4e3f739288f154ec120aebb
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-on: http://review.gluster.org/6908
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api/src/glfs.c')
| -rw-r--r-- | api/src/glfs.c | 14 | 
1 files changed, 14 insertions, 0 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index 174076e390f..ea10fb55c65 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -589,6 +589,13 @@ glfs_init_async (struct glfs *fs, glfs_init_cbk cbk)  {  	int  ret = -1; +	if (!fs || !fs->ctx) { +		gf_log ("glfs", GF_LOG_ERROR, +			"fs is not properly initialized."); +		errno = EINVAL; +		return ret; +	} +  	fs->init_cbk = cbk;  	ret = glfs_init_common (fs); @@ -602,6 +609,13 @@ glfs_init (struct glfs *fs)  {  	int  ret = -1; +	if (!fs || !fs->ctx) { +		gf_log ("glfs", GF_LOG_ERROR, +			"fs is not properly initialized."); +		errno = EINVAL; +		return ret; +	} +  	ret = glfs_init_common (fs);  	if (ret)  		return ret;  | 
