diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-11 11:13:27 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-11 11:13:27 +0000 |
commit | c41143fb1d63596ff2a0f6da741b4bae73b8be16 (patch) | |
tree | d70c0763693cfef7bc877f21e079986944261a5f /libiberty | |
parent | eb0badc13724022c8828a55e516d0eecdc487cc3 (diff) | |
download | gcc-c41143fb1d63596ff2a0f6da741b4bae73b8be16.tar.gz |
2011-05-11 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 173647 using svnmerge
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@173652 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 23 | ||||
-rw-r--r-- | libiberty/cp-demint.c | 6 | ||||
-rw-r--r-- | libiberty/cplus-dem.c | 3 | ||||
-rw-r--r-- | libiberty/makefile.vms | 2 | ||||
-rw-r--r-- | libiberty/pex-common.c | 9 | ||||
-rw-r--r-- | libiberty/pex-msdos.c | 6 | ||||
-rw-r--r-- | libiberty/pex-win32.c | 24 | ||||
-rw-r--r-- | libiberty/regex.c | 11 | ||||
-rw-r--r-- | libiberty/spaces.c | 5 | ||||
-rw-r--r-- | libiberty/testsuite/test-expandargv.c | 2 |
10 files changed, 46 insertions, 45 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index dc926382a8e..0e88ea3cc9e 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,26 @@ +2011-04-20 Jim Meyering <meyering@redhat.com> + + * cp-demint.c (cplus_demangle_v3_components): Remove useless + if-before-free. + * cplus-dem.c (squangle_mop_up): Likewise. + (delete_non_B_K_work_stuff): Likewise. + * pex-common.c (pex_free): Likewise. + * pex-msdos.c (pex_msdos_cleanup): Likewise. + * pex-win32.c (mingw_rootify, msys_rootify): Likewise. + (win32_spawn): Likewise. + * regex.c (FREE_VAR, weak_alias): Likewise. + * spaces.c (spaces): Likewise. + +2011-04-10 Jim Meyering <meyering@redhat.com> + + Avoid memory overrun in a test leading to potential double-free. + * testsuite/test-expandargv.c (writeout_test): Fix off-by-one error: + i.e., do copy the trailing NUL byte. + +2011-03-31 Tristan Gingold <gingold@adacore.com> + + * makefile.vms (OBJS): Add filename_cmp.obj + 2011-02-28 Kai Tietz <kai.tietz@onevision.com> * filename_cmp.c (filename_ncmp): New function. diff --git a/libiberty/cp-demint.c b/libiberty/cp-demint.c index 2e8f8d2d057..1d1a77af748 100644 --- a/libiberty/cp-demint.c +++ b/libiberty/cp-demint.c @@ -206,10 +206,8 @@ cplus_demangle_v3_components (const char *mangled, int options, void **mem) malloc (di.num_subs * sizeof (struct demangle_component *))); if (di.comps == NULL || di.subs == NULL) { - if (di.comps != NULL) - free (di.comps); - if (di.subs != NULL) - free (di.subs); + free (di.comps); + free (di.subs); return NULL; } diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 84f94b6a8de..e94848767e7 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -1311,8 +1311,7 @@ delete_non_B_K_work_stuff (struct work_stuff *work) int i; for (i = 0; i < work->ntmpl_args; i++) - if (work->tmpl_argvec[i]) - free ((char*) work->tmpl_argvec[i]); + free ((char*) work->tmpl_argvec[i]); free ((char*) work->tmpl_argvec); work->tmpl_argvec = NULL; diff --git a/libiberty/makefile.vms b/libiberty/makefile.vms index d69d7d9efa2..606adac0964 100644 --- a/libiberty/makefile.vms +++ b/libiberty/makefile.vms @@ -9,7 +9,7 @@ OBJS=getopt.obj,obstack.obj,xexit.obj,xmalloc.obj,hex.obj,\ getopt1.obj,cplus-dem.obj,cp-demangle.obj,cp-demint.obj,\ - asprintf.obj vasprintf.obj,mkstemps.obj,\ + asprintf.obj vasprintf.obj,mkstemps.obj,filename_cmp.obj,\ concat.obj,getruntime.obj,getpagesize.obj,getpwd.obj,xstrerror.obj,\ xmemdup.obj,xstrdup.obj,xatexit.obj,choose-temp.obj,fnmatch.obj,\ objalloc.obj,safe-ctype.obj,hashtab.obj,lbasename.obj,argv.obj,\ diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c index 55b63ae33fe..6fd3fdecd80 100644 --- a/libiberty/pex-common.c +++ b/libiberty/pex-common.c @@ -623,12 +623,9 @@ pex_free (struct pex_obj *obj) if (obj->next_input_name_allocated) free (obj->next_input_name); - if (obj->children != NULL) - free (obj->children); - if (obj->status != NULL) - free (obj->status); - if (obj->time != NULL) - free (obj->time); + free (obj->children); + free (obj->status); + free (obj->time); if (obj->remove_count > 0) { diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c index 4b77bf655fb..fa0f40ac9ed 100644 --- a/libiberty/pex-msdos.c +++ b/libiberty/pex-msdos.c @@ -310,10 +310,8 @@ pex_msdos_cleanup (struct pex_obj *obj) ms = (struct pex_msdos *) obj->sysdep; for (i = 0; i < PEX_MSDOS_FILE_COUNT; ++i) - if (msdos->files[i] != NULL) - free (msdos->files[i]); - if (msdos->statuses != NULL) - free (msdos->statuses); + free (msdos->files[i]); + free (msdos->statuses); free (msdos); obj->sysdep = NULL; } diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c index 44274067482..107ac6fdcc1 100644 --- a/libiberty/pex-win32.c +++ b/libiberty/pex-win32.c @@ -210,10 +210,8 @@ mingw_rootify (const char *executable) if (!namebuf || !foundbuf) { RegCloseKey (hKey); - if (namebuf) - free (namebuf); - if (foundbuf) - free (foundbuf); + free (namebuf); + free (foundbuf); return executable; } @@ -315,8 +313,7 @@ msys_rootify (const char *executable) return tack_on_executable (buf, executable); /* failed */ - if (buf) - free (buf); + free (buf); return executable; } #endif @@ -607,8 +604,7 @@ win32_spawn (const char *executable, si, pi)) { - if (env_block) - free (env_block); + free (env_block); free (full_executable); @@ -618,18 +614,14 @@ win32_spawn (const char *executable, /* Clean up. */ CloseHandle (pi->hThread); free (full_executable); - if (env_block) - free (env_block); + free (env_block); return (pid_t) pi->hProcess; error: - if (env_block) - free (env_block); - if (cmdline) - free (cmdline); - if (full_executable) - free (full_executable); + free (env_block); + free (cmdline); + free (full_executable); return (pid_t) -1; } diff --git a/libiberty/regex.c b/libiberty/regex.c index 420c7f4a47d..d65eedb1670 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -4970,7 +4970,7 @@ weak_alias (__re_search_2, re_search_2) #ifdef MATCH_MAY_ALLOCATE # define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL #else -# define FREE_VAR(var) if (var) free (var); var = NULL +# define FREE_VAR(var) free (var); var = NULL #endif #ifdef WCHAR @@ -8111,20 +8111,17 @@ weak_alias (__regerror, regerror) void regfree (regex_t *preg) { - if (preg->buffer != NULL) - free (preg->buffer); + free (preg->buffer); preg->buffer = NULL; preg->allocated = 0; preg->used = 0; - if (preg->fastmap != NULL) - free (preg->fastmap); + free (preg->fastmap); preg->fastmap = NULL; preg->fastmap_accurate = 0; - if (preg->translate != NULL) - free (preg->translate); + free (preg->translate); preg->translate = NULL; } #ifdef _LIBC diff --git a/libiberty/spaces.c b/libiberty/spaces.c index 67481c9bcd8..69d7a2d3f83 100644 --- a/libiberty/spaces.c +++ b/libiberty/spaces.c @@ -53,10 +53,7 @@ spaces (int count) if (count > maxsize) { - if (buf) - { - free (buf); - } + free (buf); buf = (char *) malloc (count + 1); if (buf == (char *) 0) return 0; diff --git a/libiberty/testsuite/test-expandargv.c b/libiberty/testsuite/test-expandargv.c index c16a0322a6c..57b96b3ff97 100644 --- a/libiberty/testsuite/test-expandargv.c +++ b/libiberty/testsuite/test-expandargv.c @@ -204,7 +204,7 @@ writeout_test (int test, const char * test_data) if (parse == NULL) fatal_error (__LINE__, "Failed to malloc parse.", errno); - memcpy (parse, test_data, sizeof (char) * len); + memcpy (parse, test_data, sizeof (char) * (len + 1)); /* Run all possible replaces */ run_replaces (parse); |