summaryrefslogtreecommitdiffstats
path: root/cddl/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib')
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c2
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c37
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.h4
3 files changed, 21 insertions, 22 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
index 5442683..0b531c5 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
@@ -469,7 +469,7 @@ dof_add_probe(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
* locally so an alternate symbol is added for the purpose
* of this relocation.
*/
- if (pip->pi_rname[0] == '\0')
+ if (pip->pi_rname == NULL)
dofr.dofr_name = dofpr.dofpr_func;
else
dofr.dofr_name = dof_add_string(ddo, pip->pi_rname);
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
index 0f1bfe0..6acb86b 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
@@ -520,6 +520,8 @@ dt_probe_destroy(dt_probe_t *prp)
for (pip = prp->pr_inst; pip != NULL; pip = pip_next) {
pip_next = pip->pi_next;
+ dt_free(dtp, pip->pi_rname);
+ dt_free(dtp, pip->pi_fname);
dt_free(dtp, pip->pi_offs);
dt_free(dtp, pip->pi_enoffs);
dt_free(dtp, pip);
@@ -552,28 +554,18 @@ dt_probe_define(dt_provider_t *pvp, dt_probe_t *prp,
if ((pip = dt_zalloc(dtp, sizeof (*pip))) == NULL)
return (-1);
- if ((pip->pi_offs = dt_zalloc(dtp,
- sizeof (uint32_t))) == NULL) {
- dt_free(dtp, pip);
- return (-1);
- }
+ if ((pip->pi_offs = dt_zalloc(dtp, sizeof (uint32_t))) == NULL)
+ goto nomem;
if ((pip->pi_enoffs = dt_zalloc(dtp,
- sizeof (uint32_t))) == NULL) {
- dt_free(dtp, pip->pi_offs);
- dt_free(dtp, pip);
- return (-1);
- }
+ sizeof (uint32_t))) == NULL)
+ goto nomem;
- (void) strlcpy(pip->pi_fname, fname, sizeof (pip->pi_fname));
- if (rname != NULL) {
- if (strlen(rname) + 1 > sizeof (pip->pi_rname)) {
- dt_free(dtp, pip->pi_offs);
- dt_free(dtp, pip);
- return (dt_set_errno(dtp, EDT_COMPILER));
- }
- (void) strcpy(pip->pi_rname, rname);
- }
+ if ((pip->pi_fname = strdup(fname)) == NULL)
+ goto nomem;
+
+ if (rname != NULL && (pip->pi_rname = strdup(rname)) == NULL)
+ goto nomem;
pip->pi_noffs = 0;
pip->pi_maxoffs = 1;
@@ -618,6 +610,13 @@ dt_probe_define(dt_provider_t *pvp, dt_probe_t *prp,
(*offs)[(*noffs)++] = offset;
return (0);
+
+nomem:
+ dt_free(dtp, pip->pi_fname);
+ dt_free(dtp, pip->pi_enoffs);
+ dt_free(dtp, pip->pi_offs);
+ dt_free(dtp, pip);
+ return (dt_set_errno(dtp, EDT_NOMEM));
}
/*
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.h
index af4ec33..2752baa 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.h
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.h
@@ -64,8 +64,8 @@ typedef struct dt_probe_iter {
} dt_probe_iter_t;
typedef struct dt_probe_instance {
- char pi_fname[DTRACE_FUNCNAMELEN]; /* function name */
- char pi_rname[DTRACE_FUNCNAMELEN + 20]; /* mangled relocation name */
+ char *pi_fname; /* function name */
+ char *pi_rname; /* mangled relocation name */
uint32_t *pi_offs; /* offsets into the function */
uint32_t *pi_enoffs; /* is-enabled offsets */
uint_t pi_noffs; /* number of offsets */
OpenPOWER on IntegriCloud