Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/lib/libdtrace/common Stop using alloca
details: https://anonhg.NetBSD.org/src/rev/57945e45aa8c
branches: trunk
changeset: 938338:57945e45aa8c
user: christos <christos%NetBSD.org@localhost>
date: Sun Sep 06 21:49:44 2020 +0000
description:
Stop using alloca
diffstat:
external/cddl/osnet/dist/lib/libdtrace/common/dt_options.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r 0fb81f39f238 -r 57945e45aa8c external/cddl/osnet/dist/lib/libdtrace/common/dt_options.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_options.c Sun Sep 06 21:49:32 2020 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_options.c Sun Sep 06 21:49:44 2020 +0000
@@ -904,8 +904,9 @@
if (hdr.dofh_loadsz < sizeof (dof_hdr_t))
return (dt_set_errno(dtp, EINVAL));
- dof = alloca(hdr.dofh_loadsz);
- bzero(dof, sizeof (dof_hdr_t));
+ dof = calloc(hdr.dofh_loadsz, 1);
+ if (dof == NULL)
+ return (dt_set_errno(dtp, errno));
dof->dofh_loadsz = hdr.dofh_loadsz;
for (i = 0; i < DTRACEOPT_MAX; i++)
@@ -916,7 +917,10 @@
#else
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &dof) == -1)
#endif
+ {
+ free(dof);
return (dt_set_errno(dtp, errno));
+ }
for (i = 0; i < dof->dofh_secnum; i++) {
sec = (dof_sec_t *)(uintptr_t)((uintptr_t)dof +
@@ -940,7 +944,7 @@
dtp->dt_options[opt->dofo_option] = opt->dofo_value;
}
-
+ free(dof);
return (0);
}
Home |
Main Index |
Thread Index |
Old Index