From: Jesper Juhl Date: Mon, 14 Mar 2011 11:06:05 +0000 (-0700) Subject: [SCSI] target: Avoid mem leak and needless work in transport_generic_get_mem X-Git-Tag: v2.6.39-rc1~52^2~34 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=872105689eeccbcd77377d6a29f69bba3b0cbe3b;p=pandora-kernel.git [SCSI] target: Avoid mem leak and needless work in transport_generic_get_mem In drivers/target/target_core_transport.c::transport_generic_get_mem() there are a few potential memory leaks in the error paths. This patch makes sure that we free previously allocated memory when other allocations fail. It also moves some work (INIT_LIST_HEAD() and assignment to se_mem->se_len) below all the allocations so that if something fails we don't do the work at all. Signed-off-by: Jesper Juhl Signed-off-by: Nicholas A. Bellinger Signed-off-by: James Bottomley --- Reading git-diff-tree failed