Team,
I plan to send out these patches today around 4. Please let me know if you see
anything that I should revise ..
Thanks,
Hi,
The following issues were found by Coverity source code scanner.
The patch below resolves some minor memory/resource leaks found in the bash-3.1
package.
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACH\TYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bas\h' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=\64 -O2 -g -pipe -m32 -march=i386 -mtune=pentium4
uname output: Linux system.ibm.com 2.6.9-11.ELsmp #1 SMP Fri May 20 18:26:27 EDT
2005 i68\6 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu
Bash Version: 3.0
Patch Level: 15
Release Status: release
Description:
1 - variable "temp_results" was not being freed before exiting.
2 - variable "keys" was not being freed before the return.
3 - if (arg != 0) but (*arg==0) then we return without freeing arg. if arg is
null, then the free() won't have an effect.
4 - "cmatches" and "tmatches" variables are being assigned in GEN_XCOMPS() and
GEN_COMPS() but not being freed. They are freed within the if()
statement. so I used the same functions strvec_dispose() and
strlist_dispose() to free them before the return.
- Loulwa
diff -uprN bash-3.1/lib/glob/glob.c bash-3.1-res-leak/lib/glob/glob.c
--- bash-3.1/lib/glob/glob.c 2005-03-24 11:42:27.000000000 -0600
+++ bash-3.1-res-leak/lib/glob/glob.c 2006-06-13 15:48:13.373414280 -0500
@@ -782,6 +782,7 @@ glob_filename (pathname, flags)
/* Note that the elements of ARRAY are not freed. */
free ((char *) array);
}
+ free ((char *) temp_results);
}
/* Free the directories. */
for (i = 0; directories[i]; i++)
@@ -838,6 +839,7 @@ glob_filename (pathname, flags)
result = glob_dir_to_array (directory_name, temp_results, flags);
if (free_dirname)
free (directory_name);
+ free ((char *) temp_results);
return (result);
}
diff -uprN bash-3.1/lib/readline/bind.c bash-3.1-res-leak/lib/readline/bind.c
--- bash-3.1/lib/readline/bind.c 2005-10-14 10:04:27.000000000 -0500
+++ bash-3.1-res-leak/lib/readline/bind.c 2006-06-26 13:53:35.307684848
-0500
@@ -370,7 +370,10 @@ rl_generic_bind (type, keyseq, data, map
ic = uc;
if (ic < 0 || ic >= KEYMAP_SIZE)
+ {
+ free (keys);
return -1;
+ }
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
{
diff -uprN bash-3.1/lib/readline/kill.c bash-3.1-res-leak/lib/readline/kill.c
--- bash-3.1/lib/readline/kill.c 2004-01-28 14:38:39.000000000 -0600
+++ bash-3.1-res-leak/lib/readline/kill.c 2006-06-26 11:41:19.114169648
-0500
@@ -582,6 +582,7 @@ rl_yank_nth_arg_internal (count, ignore,
if (!arg || !*arg)
{
rl_ding ();
+ free (arg);
return -1;
}
diff -uprN bash-3.1/pcomplete.c bash-3.1-res-leak/pcomplete.c
--- bash-3.1/pcomplete.c 2005-11-16 12:42:20.000000000 -0600
+++ bash-3.1-res-leak/pcomplete.c 2006-06-02 17:54:07.945706104 -0500
@@ -782,6 +782,8 @@ gen_action_completions (cs, text)
strlist_dispose (tmatches);
}
+ strvec_dispose (cmatches);
+ strlist_dispose (tmatches);
return ret;
}
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash