We should free "desc" before returning NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
GET_KIOV(desc) = kcalloc(nfrags, sizeof(*GET_KIOV(desc)),
GFP_NOFS);
if (!GET_KIOV(desc))
- goto out;
+ goto free_desc;
} else {
GET_KVEC(desc) = kcalloc(nfrags, sizeof(*GET_KVEC(desc)),
GFP_NOFS);
if (!GET_KVEC(desc))
- goto out;
+ goto free_desc;
}
spin_lock_init(&desc->bd_lock);
LNetInvalidateHandle(&desc->bd_mds[i]);
return desc;
-out:
+free_desc:
+ kfree(desc);
return NULL;
}