NetBSD Problem Report #50685
From www@NetBSD.org Thu Jan 21 16:33:48 2016
Return-Path: <www@NetBSD.org>
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 2D16F7ABE0
for <gnats-bugs@gnats.NetBSD.org>; Thu, 21 Jan 2016 16:33:48 +0000 (UTC)
Message-Id: <20160121163347.130D57ACC8@mollari.NetBSD.org>
Date: Thu, 21 Jan 2016 16:33:46 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: [src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:841]: (error) Memory leak: header_img
X-Send-Pr-Version: www-1.0
>Number: 50685
>Category: port-powerpc
>Synopsis: [src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:841]: (error) Memory leak: header_img
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-powerpc-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 21 16:35:00 +0000 2016
>Closed-Date: Thu Jan 21 21:04:39 +0000 2016
>Last-Modified: Thu Jan 21 21:04:39 +0000 2016
>Originator: David Binderman
>Release: cvs dated 20160121
>Organization:
>Environment:
>Description:
Source code is
close(bebox_fd);
return 0;
}
No matching calls to malloc & free
$ fgrep header_img src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c
unsigned char *elf_img = NULL, *kern_img = NULL, *header_img = NULL;
header_img = (unsigned char *)malloc(BEBOX_HEADER_SIZE);
if (!header_img)
memset(header_img, 0, BEBOX_HEADER_SIZE);
memcpy(header_img + p->offset, p->data, p->size);
memset(header_img + BEBOX_FILE_BLOCK_MAP_START, 0xff,
*(int32_t *)(header_img + BEBOX_FILE_SIZE_OFFSET) =
*(int32_t *)(header_img + BEBOX_FILE_SIZE_ALIGN_OFFSET) =
*(int32_t *)(header_img + *offset) =
write(bebox_fd, header_img, BEBOX_HEADER_SIZE);
/* refill the header_img with zeros */
memset(header_img, 0, BEBOX_BLOCK_SIZE * 2);
write(bebox_fd, header_img, flength - endoff);
$
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50685 CVS commit: src/sys/arch/powerpc/stand/mkbootimage
Date: Thu, 21 Jan 2016 12:14:06 -0500
Module Name: src
Committed By: christos
Date: Thu Jan 21 17:14:05 UTC 2016
Modified Files:
src/sys/arch/powerpc/stand/mkbootimage: mkbootimage.c
Log Message:
PR/50685: David Binderman: fix memory leak
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.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: wiz@NetBSD.org
State-Changed-When: Thu, 21 Jan 2016 21:04:39 +0000
State-Changed-Why:
Fixed by christos, thanks!
>Unformatted:
(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.