From owner-freebsd-scsi@FreeBSD.ORG Sun Apr 26 19:22:22 2015 Return-Path: Delivered-To: freebsd-scsi@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 632A6BB0 for ; Sun, 26 Apr 2015 19:22:22 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D79D185B for ; Sun, 26 Apr 2015 19:22:22 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t3QJMMUk022247 for ; Sun, 26 Apr 2015 19:22:22 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-scsi@FreeBSD.org Subject: [Bug 199671] [patch] memory leak in cam scsi Date: Sun, 26 Apr 2015 19:22:22 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: pfg@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-scsi@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.isobsolete Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2015 19:22:22 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199671 Pedro F. Giffuni changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #156014|0 |1 is obsolete| | --- Comment #5 from Pedro F. Giffuni --- Comment on attachment 156014 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=156014 Fix avoiding double free (In reply to Steven Hartland from comment #4) I think assigning the NULLs is actually unnecessary: all the occasions where scan_info is free'd go to a break. The first patch seems fine. Moving the free() out of the loop would be a possibility but seems better to release the memory as soon as it is used, and I suspect that's what the author had in mind. OTOH, but this is just me, I prefer to avoid modifying existing code since this is not something I can test. -- You are receiving this mail because: You are the assignee for the bug.