bug-bash
[Top][All Lists]
Advanced

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

Bash-3.2 Official Patch 38


From: Chet Ramey
Subject: Bash-3.2 Official Patch 38
Date: Fri, 2 May 2008 23:49:06 -0400

                             BASH PATCH REPORT
                             =================

Bash-Release: 3.2
Patch-ID: bash32-038

Bug-Reported-by:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
Bug-Reference-ID:       <200803131141.m2DBf9vo001136@wojtek.tensor.gdynia.pl>
Bug-Reference-URL:      
http://lists.gnu.org/archive/html/bug-bash/2008-03/msg00029.html

Bug-Description:

When reading input lines into a single variable using the `read' builtin,
bash did not free the memory it read after assigining it to the named
variable, causing a memory leak noticable when reading large amounts of
data.


Patch:

*** ../bash-3.2-patched/builtins/read.def       2007-08-25 13:47:07.000000000 
-0400
--- builtins/read.def   2008-03-07 12:55:47.000000000 -0500
***************
*** 135,139 ****
    char c;
    char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
!   char *e, *t, *t1, *ps2;
    struct stat tsb;
    SHELL_VAR *var;
--- 152,156 ----
    char c;
    char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
!   char *e, *t, *t1, *ps2, *tofree;
    struct stat tsb;
    SHELL_VAR *var;
***************
*** 675,678 ****
--- 728,732 ----
    /* Check whether or not the number of fields is exactly the same as the
       number of variables. */
+   tofree = NULL;
    if (*input_string)
      {
***************
*** 680,684 ****
        t = get_word_from_string (&input_string, ifs_chars, &e);
        if (*input_string == 0)
!       input_string = t;
        else
        input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, 
saw_escape);
--- 734,738 ----
        t = get_word_from_string (&input_string, ifs_chars, &e);
        if (*input_string == 0)
!       tofree = input_string = t;
        else
        input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, 
saw_escape);
***************
*** 695,698 ****
--- 749,754 ----
      var = bind_read_variable (list->word->word, input_string);
    stupidly_hack_special_variables (list->word->word);
+   FREE (tofree);
+ 
    if (var)
      VUNSETATTR (var, att_invisible);
*** ../bash-3.2/patchlevel.h    Thu Apr 13 08:31:04 2006
--- patchlevel.h        Mon Oct 16 14:22:54 2006
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 37
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 38
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]