summaryrefslogtreecommitdiffstats
path: root/lib/libproc/proc_rtld.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libproc/proc_rtld.c')
-rw-r--r--lib/libproc/proc_rtld.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libproc/proc_rtld.c b/lib/libproc/proc_rtld.c
index 5caadd9e..2a9ed39 100644
--- a/lib/libproc/proc_rtld.c
+++ b/lib/libproc/proc_rtld.c
@@ -42,14 +42,13 @@ map_iter(const rd_loadobj_t *lop, void *arg)
{
struct proc_handle *phdl = arg;
- phdl->nobjs++;
if (phdl->nobjs >= phdl->rdobjsz) {
phdl->rdobjsz *= 2;
phdl->rdobjs = realloc(phdl->rdobjs, phdl->rdobjsz);
if (phdl->rdobjs == NULL)
return (-1);
}
- memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*phdl->rdobjs));
+ memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*lop));
return (0);
}
@@ -61,6 +60,7 @@ proc_rdagent(struct proc_handle *phdl)
phdl->status != PS_IDLE) {
if ((phdl->rdap = rd_new(phdl)) != NULL) {
phdl->rdobjs = malloc(sizeof(*phdl->rdobjs) * 64);
+ phdl->rdobjsz = 64;
if (phdl->rdobjs == NULL)
return (phdl->rdap);
rd_loadobj_iter(phdl->rdap, map_iter, phdl);
@@ -73,7 +73,8 @@ proc_rdagent(struct proc_handle *phdl)
void
proc_updatesyms(struct proc_handle *phdl)
{
- memset(&phdl->rdobjs, 0, sizeof(*phdl->rdobjs) * phdl->rdobjsz);
+
+ memset(phdl->rdobjs, 0, sizeof(*phdl->rdobjs) * phdl->rdobjsz);
phdl->nobjs = 0;
rd_loadobj_iter(phdl->rdap, map_iter, phdl);
}
OpenPOWER on IntegriCloud