NetBSD Problem Report #51706
From www@NetBSD.org Sun Dec 11 04:51:18 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 829377A2D8
for <gnats-bugs@gnats.NetBSD.org>; Sun, 11 Dec 2016 04:51:18 +0000 (UTC)
Message-Id: <20161211045117.4659F7A305@mollari.NetBSD.org>
Date: Sun, 11 Dec 2016 04:51:17 +0000 (UTC)
From: amirpli@gmail.com
Reply-To: amirpli@gmail.com
To: gnats-bugs@NetBSD.org
Subject: libedit memory leak - el_rread
X-Send-Pr-Version: www-1.0
>Number: 51706
>Category: lib
>Synopsis: libedit memory leak - el_rread
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Dec 11 04:55:00 +0000 2016
>Closed-Date: Mon Dec 12 08:30:59 +0000 2016
>Last-Modified: Mon Dec 12 08:30:59 +0000 2016
>Originator: Amir Plivatsky
>Release: libedit
>Organization:
>Environment:
libedit-3.1-16.20160618cvs
>Description:
read_init() allocates el_read.
However, it is not freed in read_end() (which is called by el_end()).
>How-To-Repeat:
Run with LeakSanitizer.
==27324==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7ffff6efbe50 in malloc (/lib64/libasan.so.3+0xc6e50)
#1 0x7ffff5c25ac2 (/lib64/libedit.so.0+0xfac2)
SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).
...
(gdb) b *0x7ffff5c25ac2
...
Breakpoint 3, read_init (el=el@entry=0x61a00001d480) at read.c:88
88 if ((el->el_read = el_malloc(sizeof(*el->el_read))) == NULL)
(gdb) p sizeof(*el->el_read)
$1 = 32
>Fix:
Add in read_end() before its end:
el_free(el_read);
(The following can be removed:
el_read->macros.macro = NULL;)
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51706 CVS commit: src/lib/libedit
Date: Sun, 11 Dec 2016 10:47:06 -0500
Module Name: src
Committed By: christos
Date: Sun Dec 11 15:47:06 UTC 2016
Modified Files:
src/lib/libedit: read.c
Log Message:
PR/51706: Amir Plivatsky: Fix memory leak
To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/lib/libedit/read.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: Mon, 12 Dec 2016 08:30:59 +0000
State-Changed-Why:
committed, 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.