[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#217092: marked as done (libc6-dev: leaks memory in regcomp (/usr/include/regex.h))



Your message dated Tue, 28 Oct 2003 23:14:37 +0900
with message-id <80fzhda1pu.wl@oris.opensource.jp>
and subject line Bug#217092: libc6-dev: leaks memory in regcomp (/usr/include/regex.h)
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 22 Oct 2003 17:07:10 +0000
>From capitol@sigma.su.se Wed Oct 22 12:07:09 2003
Return-path: <capitol@sigma.su.se>
Received: from mail.sigma.su.se (sigma.su.se) [130.237.152.201] 
	by master.debian.org with smtp (Exim 3.35 1 (Debian))
	id 1ACMRx-0000Cg-00; Wed, 22 Oct 2003 12:07:09 -0500
Received: (qmail 10883 invoked from network); 22 Oct 2003 17:01:51 -0000
Received: from unknown (HELO paranor.sigma.su.se) (130.237.152.210)
  by mail.sigma.su.se with SMTP; 22 Oct 2003 17:01:51 -0000
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Alexander Kjall <capitol@sigma.su.se>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libc6-dev: leaks memory in regcomp (/usr/include/regex.h)
Bcc: Alexander Kjall <capitol@sigma.su.se>
X-Mailer: reportbug 2.34
Date: Wed, 22 Oct 2003 19:07:06 +0200
Message-Id: <[🔎] E1ACMRx-0000Cg-00@master.debian.org>
Delivered-To: submit@bugs.debian.org
X-Spam-Status: No, hits=-5.0 required=4.0
	tests=HAS_PACKAGE
	version=2.53-bugs.debian.org_2003_10_21
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_10_21 (1.174.2.15-2003-03-30-exp)

Package: libc6-dev
Version: 2.3.2-8
Severity: normal

A memoryleak in regcomp, a example program is included below plus some
output from valgrind.

It might be that i use it wrongly but I don't think so.

#include <sys/types.h>
#include <regex.h>

#include <iostream>
#include <string>

void cleanup(int toexit);

regex_t *reg;

bool check_input(std::string in)
{
  if(reg == 0)
  {
    reg = new regex_t;
  }
	  
  if(int err = regcomp(reg, "^[0-9]+:[A-Za-z,]+:.*$", 0))
  cleanup(err);
		
  regmatch_t ptype;
  return regexec(reg, in.c_str(), 0, &ptype, 0) != 0;
}
		    
void cleanup(int toexit)
{
  if(reg != 0)
  {
    regfree(reg);
  }
  exit(toexit);
}
				
int main(int argc, char *argv[])
{
  std::string in = "3520872:all:message";
  check_input(in.c_str());
  check_input(in.c_str());
				      
  cleanup(0);
}
					
and some of the output from valgrind
==28354== LEAK SUMMARY:
==28354==    definitely lost: 348 bytes in 2 blocks.
==28354==    possibly lost:   1280 bytes in 1 blocks.
==28354==    still reachable: 5588 bytes in 90 blocks.
==28354==         suppressed: 0 bytes in 0 blocks.
==28354== Reachable blocks (those to which a pointer was found) are not shown.
==28354== To see them, rerun with: --show-reachable=yes
==28354== 

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux paranor 2.4.21-4-k7 #1 Sun Aug 3 02:34:06 EST 2003 i686
Locale: LANG=sv_SE, LC_CTYPE=sv_SE

Versions of packages libc6-dev depends on:
ii  libc6                         2.3.2-8    GNU C Library: Shared libraries an

-- no debconf information


---------------------------------------
Received: (at 217092-done) by bugs.debian.org; 28 Oct 2003 14:20:48 +0000
>From gotom@debian.or.jp Tue Oct 28 08:14:39 2003
Return-path: <gotom@debian.or.jp>
Received: from oris.opensource.jp [218.44.239.77] 
	by master.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1AEUcI-00013h-00; Tue, 28 Oct 2003 08:14:39 -0600
Received: from oris.opensource.jp (oris.opensource.jp [218.44.239.77])
	by oris.opensource.jp (Postfix) with ESMTP
	id F411BC33C1; Tue, 28 Oct 2003 23:14:37 +0900 (JST)
Date: Tue, 28 Oct 2003 23:14:37 +0900
Message-ID: <80fzhda1pu.wl@oris.opensource.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: Colin Watson <cjwatson@debian.org>, 217092-done@bugs.debian.org
Cc: Alexander Kjall <capitol@sigma.su.se>
Subject: Re: Bug#217092: libc6-dev: leaks memory in regcomp (/usr/include/regex.h)
In-Reply-To: <[🔎] 20031022180622.GA30644@riva.ucam.org>
References: <[🔎] E1ACMRx-0000Cg-00@master.debian.org>
	<[🔎] 20031022180622.GA30644@riva.ucam.org>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 217092-done@bugs.debian.org
X-Spam-Status: No, hits=-4.7 required=4.0
	tests=BAYES_60,EMAIL_ATTRIBUTION,QUOTED_EMAIL_TEXT
	version=2.53-bugs.debian.org_2003_10_28
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_10_28 (1.174.2.15-2003-03-30-exp)

At Wed, 22 Oct 2003 19:06:22 +0100,
Colin Watson wrote:
> 
> On Wed, Oct 22, 2003 at 07:07:06PM +0200, Alexander Kjall wrote:
> > Package: libc6-dev
> > Version: 2.3.2-8
> > Severity: normal
> > 
> > A memoryleak in regcomp, a example program is included below plus some
> > output from valgrind.
> > 
> > It might be that i use it wrongly but I don't think so.
> 
> You're not calling regfree() between the first and second calls to
> regcomp(). Here's a patch:

Yes, right.  Thanks to Colin!  I've closed.

Regards,
-- gotom



Reply to: