scst_mem: Fix a memory leak triggered by the scst_user driver (merge r5829 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5830 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2014-10-03 12:27:30 +00:00
parent 74d4cabe3a
commit 3659c93d70
+7 -1
View File
@@ -1021,7 +1021,13 @@ struct scatterlist *sgv_pool_alloc(struct sgv_pool *pool, unsigned int size,
goto out_fail_free;
}
TRACE_MEM("Brand new obj %p", obj);
if (likely(!obj->recycling_list_entry.next)) {
TRACE_MEM("Brand new obj %p", obj);
} else if (unlikely(obj->sg_entries != obj->sg_entries_data)) {
TRACE_MEM("Cached obj %p with sg_count == 0", obj);
kfree(obj->sg_entries);
obj->sg_entries = NULL;
}
if (pages_to_alloc <= sgv_max_local_pages) {
obj->sg_entries = obj->sg_entries_data;