Fix 'resource leak' defects found by Coverity version 6.5.1:
Resource leak (RESOURCE_LEAK)
Variable going out of scope leaks the storage it points to.
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ieb45e4cceb26b6c1ca605ef1b1c78cf3f603dffa
Reviewed-on: http://review.whamcloud.com/6509
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
* which is already holding mmap_sem for writes. If some other
* thread gets the write lock in the meantime, this thread will
* block, but at least it won't deadlock on itself. LU-1735 */
* which is already holding mmap_sem for writes. If some other
* thread gets the write lock in the meantime, this thread will
* block, but at least it won't deadlock on itself. LU-1735 */
- if (down_read_trylock(&mm->mmap_sem) == 0)
+ if (down_read_trylock(&mm->mmap_sem) == 0) {
+ kfree(buffer);
up_read(&mm->mmap_sem);
addr = mm->env_start;
up_read(&mm->mmap_sem);
addr = mm->env_start;
return -ENOMEM;
rc = ost_lock_get(exp, oa, begin, end - begin, ®ion->lh, LCK_PR, 0);
return -ENOMEM;
rc = ost_lock_get(exp, oa, begin, end - begin, ®ion->lh, LCK_PR, 0);
+ if (rc) {
+ OBD_FREE_PTR(region);
CDEBUG(D_OTHER, "ost lock [%llu,%llu], lh=%p\n",
begin, end, ®ion->lh);
CDEBUG(D_OTHER, "ost lock [%llu,%llu], lh=%p\n",
begin, end, ®ion->lh);