From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10909 invoked by alias); 21 Jul 2005 18:02:15 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 10898 invoked by uid 22791); 21 Jul 2005 18:02:08 -0000 Received: from londo.lunn.ch (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 21 Jul 2005 18:02:08 +0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1DvfMs-0007s7-00; Thu, 21 Jul 2005 20:01:58 +0200 Date: Thu, 21 Jul 2005 18:02:00 -0000 To: Jay Foster Cc: 'John Paul King' , ecos-discuss@sources.redhat.com Message-ID: <20050721180158.GK29741@lunn.ch> Mail-Followup-To: Jay Foster , 'John Paul King' , ecos-discuss@sources.redhat.com References: <80B97DE95AEED311BA580050047FE98403259494@mail.systech.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fUYQa+Pmc3FrFX/N" Content-Disposition: inline In-Reply-To: <80B97DE95AEED311BA580050047FE98403259494@mail.systech.com> User-Agent: Mutt/1.5.9i From: Andrew Lunn Subject: Re: [ECOS] Termios memory leak? X-SW-Source: 2005-07/txt/msg00228.txt.bz2 --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 396 On Mon, Jul 18, 2005 at 09:29:25AM -0700, Jay Foster wrote: > I ran into the same problem some time ago, and made the following change to > correct it. The bug would leak 8KB of memory each time cyg_io_lookup() was > called for a termios device (after the first time). Here is what i have committed. I removed the members from the priv structure as well just to tidy things up. Andrew --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="termiotty.diff" Content-length: 1595 ? termiotty.diff Index: ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/io/serial/current/ChangeLog,v retrieving revision 1.63 diff -u -r1.63 ChangeLog --- ChangeLog 28 Jun 2005 17:56:12 -0000 1.63 +++ ChangeLog 21 Jul 2005 18:00:33 -0000 @@ -1,3 +1,8 @@ +2005-07-21 Andrew Lunn + + * src/common/termiostty.c: Removed errbuf from priv. It was never + being used after being allocated and never freed. + 2005-06-27 Andrew Lunn * src/common/serial.c (serial_select): Swap the DSR locks and Index: src/common/termiostty.c =================================================================== RCS file: /cvs/ecos/ecos/packages/io/serial/current/src/common/termiostty.c,v retrieving revision 1.6 diff -u -r1.6 termiostty.c --- src/common/termiostty.c 5 Sep 2003 05:09:19 -0000 1.6 +++ src/common/termiostty.c 21 Jul 2005 18:00:34 -0000 @@ -107,9 +107,6 @@ cyg_io_handle_t dev_handle; cyg_drv_mutex_t lock; cyg_bool init; - cyg_uint8 *errbuf; - cyg_uint8 *errbufpos; - cyg_uint32 errbufsize; }; typedef struct { @@ -256,12 +253,6 @@ &dev_buf_conf, &len ); } - priv->errbuf = (cyg_uint8 *)malloc( dev_buf_conf.rx_bufsize ); - if ( NULL == priv->errbuf ) - res = ENOMEM; // FIXME: Are we allowed to do this? - priv->errbufpos = priv->errbuf; - priv->errbufsize = dev_buf_conf.rx_bufsize; - if ( ENOERR != res ) { CYG_REPORT_RETVAL( res ); return res; --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-length: 148 -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss --fUYQa+Pmc3FrFX/N--