NetBSD Problem Report #51478

From jose@pc2.bigmail.com  Thu Sep 15 23:02:56 2016
Return-Path: <jose@pc2.bigmail.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D3DE97A273
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 15 Sep 2016 23:02:55 +0000 (UTC)
Message-Id: <20160915214605.520E723EBE51@pc2.bigmail.com>
Date: Thu, 15 Sep 2016 23:46:05 +0200 (CEST)
From: joseyluis@gmail.com
Reply-To: joseyluis@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Fix leak mem fsck_lfs/lfs.c
X-Send-Pr-Version: 3.95

>Number:         51478
>Category:       bin
>Synopsis:       Fix leak mem fsck_lfs/lfs.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 15 23:05:00 +0000 2016
>Closed-Date:    Sat Nov 19 19:22:00 +0000 2016
>Last-Modified:  Sat Nov 19 19:22:00 +0000 2016
>Originator:     Jose Luis Rodriguez Garcia <joseyluis@gmail.com>
>Release:        current
>Organization:

>Environment:
>Description:
	In src/sbin/fsck_lfs/lfs.c lfs_raw_vget funtion, when it returns with NULL case doesn't free the memory allocated of: ip->i_din and ip->inode_ext.lfs
>How-To-Repeat:
	Code review
>Fix:
Index: lfs.c
===================================================================
RCS file: /cvsroot/src/sbin/fsck_lfs/lfs.c,v
retrieving revision 1.71
diff -u -r1.71 lfs.c
--- lfs.c	20 Mar 2016 04:24:46 -0000	1.71
+++ lfs.c	15 Sep 2016 21:42:58 -0000
@@ -376,6 +376,8 @@
 		dip = lfs_ifind(fs, ino, bp);
 		if (dip == NULL) {
 			brelse(bp, 0);
+			free(ip->i_din);
+			free(ip->inode_ext.lfs);
 			free(ip);
 			free(vp);
 			return NULL;

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51478 CVS commit: src/sbin/fsck_lfs
Date: Fri, 16 Sep 2016 07:13:47 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Fri Sep 16 11:13:47 UTC 2016

 Modified Files:
 	src/sbin/fsck_lfs: lfs.c

 Log Message:
 PR/51478: Jose Luis Rodriguez Garcia: Fix leak mem fsck_lfs/lfs.c


 To generate a diff of this commit:
 cvs rdiff -u -r1.71 -r1.72 src/sbin/fsck_lfs/lfs.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 19 Nov 2016 19:22:00 +0000
State-Changed-Why:
Fix committed. Thanks for the help!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.