Remove some calls to malloc_failure
I noticed a couple of spots that call malloc_failure, but that don't need to. * In xml-support.c, "concat" uses xmalloc, so cannot return NULL. * In utils.c, "buildargv" also uses xmalloc, so can only return NULL if the argument is empty. Tested by the buildbot. gdb/ChangeLog 2019-12-12 Tom Tromey <tromey@adacore.com> * xml-support.c (xml_fetch_content_from_file): Don't call malloc_failure. * utils.h (class gdb_argv): Remove malloc_failure comment. * utils.c (gdb_argv::reset): Don't call malloc_failure. Change-Id: I59483620deb6609ccf2f024d94a29113bb62d1a9
This commit is contained in:
parent
db3ad2f031
commit
d61df89700
@ -1,3 +1,10 @@
|
||||
2019-12-12 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
* xml-support.c (xml_fetch_content_from_file): Don't call
|
||||
malloc_failure.
|
||||
* utils.h (class gdb_argv): Remove malloc_failure comment.
|
||||
* utils.c (gdb_argv::reset): Don't call malloc_failure.
|
||||
|
||||
2019-12-12 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
* Makefile.in (ALL_TARGET_OBS): Add riscv-ravenscar-thread.o.
|
||||
|
@ -3033,9 +3033,6 @@ gdb_argv::reset (const char *s)
|
||||
{
|
||||
char **argv = buildargv (s);
|
||||
|
||||
if (s != NULL && argv == NULL)
|
||||
malloc_failure (0);
|
||||
|
||||
freeargv (m_argv);
|
||||
m_argv = argv;
|
||||
}
|
||||
|
@ -146,10 +146,7 @@ public:
|
||||
}
|
||||
|
||||
/* A constructor that calls buildargv on STR. STR may be NULL, in
|
||||
which case this object is initialized with a NULL array. If
|
||||
buildargv fails due to out-of-memory, call malloc_failure.
|
||||
Therefore, the value is guaranteed to be non-NULL, unless the
|
||||
parameter itself is NULL. */
|
||||
which case this object is initialized with a NULL array. */
|
||||
|
||||
explicit gdb_argv (const char *str)
|
||||
: m_argv (NULL)
|
||||
|
@ -977,8 +977,6 @@ xml_fetch_content_from_file (const char *filename, void *baton)
|
||||
{
|
||||
char *fullname = concat (dirname, "/", filename, (char *) NULL);
|
||||
|
||||
if (fullname == NULL)
|
||||
malloc_failure (0);
|
||||
file = gdb_fopen_cloexec (fullname, FOPEN_RT);
|
||||
xfree (fullname);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user