On 13-09-25 10:05 PM, vaughan wrote:
On 09/25/2013 10:26 PM, Vegard Nossum wrote:
Commit e32c9e6300e3af659cbfe45e90a1e7dcd3572ada introduced a memory
leak. Fix it.

Cc: sta...@vger.kernel.org
Cc: Vaughan Cao <vaughan....@oracle.com>
Cc: Douglas Gilbert <dgilb...@interlog.com>
Signed-off-by: Vegard Nossum <vegard.nos...@oracle.com>
---
  drivers/scsi/sg.c |    1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 5cbc4bb..a97143f 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2060,6 +2060,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
        spin_lock_irqsave(&sdp->sfd_lock, iflags);
        if (sdp->detached) {
                spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
+               kfree(sfp);
                return ERR_PTR(-ENODEV);
        }
        list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
You're right. It's a memory leak.

Signed-off-by: Douglas Gilbert <dgilb...@interlog.com>


There also a memory leak at the second 'return NULL;'
in dev_seq_start() .

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to