aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-thread-db.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/linux-thread-db.c')
-rw-r--r--gdb/linux-thread-db.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index b5719eb..91bd0dc 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -873,6 +873,7 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
char *path, *cp;
int result;
const char *obj_name = objfile_name (obj);
+ int alloc_len;
if (obj_name[0] != '/')
{
@@ -881,8 +882,10 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
return 0;
}
- path = xmalloc (strlen (obj_name) + (subdir ? strlen (subdir) + 1 : 0)
- + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ alloc_len = (strlen (obj_name)
+ + (subdir ? strlen (subdir) + 1 : 0)
+ + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ path = (char *) xmalloc (alloc_len);
cleanup = make_cleanup (xfree, path);
strcpy (path, obj_name);
@@ -959,7 +962,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
if (!auto_load_thread_db)
return 0;
- path = xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+ path = (char *) xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
cleanup = make_cleanup (xfree, path);
memcpy (path, dir, dir_len);
@@ -1004,7 +1007,7 @@ thread_db_load_search (void)
if (this_dir[pdir_len] == '/')
{
- subdir = xmalloc (strlen (this_dir));
+ subdir = (char *) xmalloc (strlen (this_dir));
make_cleanup (xfree, subdir);
strcpy (subdir, this_dir + pdir_len + 1);
}
@@ -2059,7 +2062,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
ui_out_table_header (uiout, pids_len, ui_left, "PIDs", "Pids");
ui_out_table_body (uiout);
- pids = xmalloc (max_pids_len + 1);
+ pids = (char *) xmalloc (max_pids_len + 1);
make_cleanup (xfree, pids);
/* Note I is incremented inside the cycle, not at its end. */