diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-04-20 17:43:25 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-04-20 17:43:25 +0000 |
commit | 1f2b051d84547c7ee9a163a267a76e3c8ca4a4fe (patch) | |
tree | 68513c43c1b0be132373bde685b48ac9a85f13f0 | |
parent | 2d445fb18c3d0ca4b9673a8a7fda67f57f46e06e (diff) |
Notes
-rw-r--r-- | lib/libthread_db/libpthread_db.c | 13 | ||||
-rw-r--r-- | lib/libthread_db/libpthread_db.h | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/libthread_db/libpthread_db.c b/lib/libthread_db/libpthread_db.c index e190e56116890..66b813ec50d89 100644 --- a/lib/libthread_db/libpthread_db.c +++ b/lib/libthread_db/libpthread_db.c @@ -74,7 +74,8 @@ pt_map_thread(const td_thragent_t *const_ta, psaddr_t pt, enum pt_type type) { td_thragent_t *ta = __DECONST(td_thragent_t *, const_ta); struct pt_map *new; - int i, first = -1; + int first = -1; + unsigned int i; /* leave zero out */ for (i = 1; i < ta->map_len; ++i) { @@ -94,12 +95,12 @@ pt_map_thread(const td_thragent_t *const_ta, psaddr_t pt, enum pt_type type) ta->map_len = 20; first = 1; } else { - new = realloc(ta->map, - sizeof(struct pt_map) * ta->map_len * 2); + new = reallocarray(ta->map, ta->map_len, + 2 * sizeof(struct pt_map)); if (new == NULL) return (-1); - memset(new + ta->map_len, '\0', sizeof(struct pt_map) * - ta->map_len); + memset(new + ta->map_len, '\0', ta->map_len * + 2 * sizeof(struct pt_map)); first = ta->map_len; ta->map = new; ta->map_len *= 2; @@ -1047,7 +1048,7 @@ pt_thr_sstep(const td_thrhandle_t *th, int step) static void pt_unmap_lwp(const td_thragent_t *ta, lwpid_t lwp) { - int i; + unsigned int i; for (i = 0; i < ta->map_len; ++i) { if (ta->map[i].type == PT_LWP && ta->map[i].lwp == lwp) { diff --git a/lib/libthread_db/libpthread_db.h b/lib/libthread_db/libpthread_db.h index 44c5de6ce93c5..79f6aa5bcacbc 100644 --- a/lib/libthread_db/libpthread_db.h +++ b/lib/libthread_db/libpthread_db.h @@ -77,7 +77,7 @@ struct td_thragent { int thread_off_sigmask; int thread_off_sigpend; struct pt_map *map; - int map_len; + unsigned int map_len; }; void pt_md_init(void); |