diff options
author | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-11-04 22:51:31 +0000 |
---|---|---|
committer | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-11-04 22:51:31 +0000 |
commit | 3bc9d50eaa95af0c5de6e5408bf91b0001b56280 (patch) | |
tree | 7c94ac4f06d187c523ca25124dbfdc348e80d080 | |
parent | 8e80a04c043244eb2fdf0541b5ed86bd53d71736 (diff) |
Add missing error handling to this case where a memory allocation fails.
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@170 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
-rw-r--r-- | modules/spl/spl-kobj.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/spl/spl-kobj.c b/modules/spl/spl-kobj.c index 28ff74e7c..e78cd9244 100644 --- a/modules/spl/spl-kobj.c +++ b/modules/spl/spl-kobj.c @@ -40,10 +40,15 @@ kobj_open_file(const char *name) int rc; ENTRY; - if ((rc = vn_open(name, UIO_SYSSPACE, FREAD, 0644, &vp, 0, 0))) + file = kmalloc(sizeof(_buf_t), GFP_KERNEL); + if (file == NULL) RETURN((_buf_t *)-1UL); - file = kmalloc(sizeof(_buf_t), GFP_KERNEL); + if ((rc = vn_open(name, UIO_SYSSPACE, FREAD, 0644, &vp, 0, 0))) { + kfree(file); + RETURN((_buf_t *)-1UL); + } + file->vp = vp; RETURN(file); |