NetBSD Problem Report #46899

From Wolfgang.Stukenbrock@nagler-company.com  Tue Sep  4 12:01:16 2012
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 0E5CA63B86D
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  4 Sep 2012 12:01:16 +0000 (UTC)
Message-Id: <20120904120106.594FB1E80A9@test-s0.nagler-company.com>
Date: Tue,  4 Sep 2012 14:01:06 +0200 (CEST)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: memory leak in libutil - getfsspecname()
X-Send-Pr-Version: 3.95

>Number:         46899
>Category:       lib
>Synopsis:       memory leak in libutil - getfsspecname()
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 04 12:05:00 +0000 2012
>Closed-Date:    Thu Aug 24 08:38:42 +0000 2017
>Last-Modified:  Thu Aug 24 08:38:42 +0000 2017
>Originator:     Wolfgang Stukenbrock
>Release:        NetBSD-current
>Organization:
Dr. Nagler & Company GmbH
>Environment:


System: NetBSD test-s0 4.0 NetBSD 4.0 (NSW-WS) #0: Tue Aug 17 17:28:09 CEST 2010 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
	There are missing free() calls for the variables drives and vname
	prior returning variable buf to caller to signal success.
>How-To-Repeat:
	Found by a look into the sources.
>Fix:
	add missing free() calls - e.g. with a patch like this:

	char *p = strstr(buf, "/rdk");
-	if (p++ == NULL)
-		return buf;
-	strcpy(p, p + 1);
+	if (p++ != NULL)
+		strcpy(p, p + 1);
	free(drives);
	free(vname);
	return buf;

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: maxv@NetBSD.org
State-Changed-When: Thu, 24 Aug 2017 08:38:42 +0000
State-Changed-Why:
Fixed in 2014, thanks for the report.


>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.