🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #126

memory leak, also trouble with echo (bash 0.99)

#126
From: Andy Fyfe
Date: Fri, 16 Jun 1989 02:29
32 lines
1295 bytes
[running on a sun3, sunos 3.5]
The routine init_terminal_io calls "xmalloc" but never "free".  It gets
called, it seems, with every (or at least many) SIGWINCH, and in no time
you can have a *VERY* large data segment.  Included is a patch changing
the xmalloc to alloca.  (Then again, maybe it would be best to just
allocate a fixed buffer?)

On the suns,
	$ echo '\'
	\UUUU

Where do the U's come from?

*** save/readline.c	Thu Jun 15 19:04:05 1989
--- readline.c	Thu Jun 15 19:04:09 1989
***************
*** 1234,1240 ****
      return;
    }
  
!   buffer = (char *)xmalloc (2048);
    BC = tgetstr ("pc", &buffer);
    PC = buffer ? *buffer : 0;
    BC = tgetstr ("le", &buffer);
--- 1234,1240 ----
      return;
    }
  
!   buffer = (char *)alloca (2048);
    BC = tgetstr ("pc", &buffer);
    PC = buffer ? *buffer : 0;
    BC = tgetstr ("le", &buffer);
Technical Details
Message-ID: <8906160229.AA05556@cit-vlsi>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cit-vlsi.ai.mit.edu!andy

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cit-vlsi.ai.mit.edu!andy
From: andy@cit-vlsi.ai.mit.edu (Andy Fyfe)
Newsgroups: gnu.bash.bug
Subject: memory leak, also trouble with echo (bash 0.99)
Message-ID: <8906160229.AA05556@cit-vlsi>
Date: 16 Jun 89 02:29:17 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 32