diff options
author | Glen Barber <gjb@FreeBSD.org> | 2016-03-14 18:54:29 +0000 |
---|---|---|
committer | Glen Barber <gjb@FreeBSD.org> | 2016-03-14 18:54:29 +0000 |
commit | 538354481ef7dbcd76ebc7334512a9d60994b84e (patch) | |
tree | 7aa3dd8f24b6558f2ef57be4db6203ac91424ea3 /cddl | |
parent | 7d536dc855c85c15bf45f033d108a61b1f3cecc3 (diff) | |
parent | 9580c0f7ce319d3e4e213faa40b59bd91c7b66ba (diff) | |
download | src-test2-538354481ef7dbcd76ebc7334512a9d60994b84e.tar.gz src-test2-538354481ef7dbcd76ebc7334512a9d60994b84e.zip |
Notes
Diffstat (limited to 'cddl')
3 files changed, 14 insertions, 14 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 77f92237e210..5fe256503f5e 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -24,6 +24,7 @@ */ /* * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2016, Pedro Giffuni. All rights reserved. */ #include <sys/types.h> @@ -721,22 +722,20 @@ dt_module_load_proc(dtrace_hdl_t *dtp, dt_module_t *dmp) return (dt_set_errno(dtp, EDT_CANTLOAD)); } - dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count); + dmp->dm_libctfp = calloc(arg.dpa_count, sizeof (ctf_file_t *)); if (dmp->dm_libctfp == NULL) { dt_proc_unlock(dtp, p); dt_proc_release(dtp, p); return (dt_set_errno(dtp, EDT_NOMEM)); } - bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count); - dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count); + dmp->dm_libctfn = calloc(arg.dpa_count, sizeof (char *)); if (dmp->dm_libctfn == NULL) { free(dmp->dm_libctfp); dt_proc_unlock(dtp, p); dt_proc_release(dtp, p); return (dt_set_errno(dtp, EDT_NOMEM)); } - bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count); dmp->dm_nctflibs = arg.dpa_count; @@ -817,17 +816,14 @@ dt_module_load(dtrace_hdl_t *dtp, dt_module_t *dmp) dmp->dm_nsymbuckets = _dtrace_strbuckets; dmp->dm_symfree = 1; /* first free element is index 1 */ - dmp->dm_symbuckets = malloc(sizeof (uint_t) * dmp->dm_nsymbuckets); - dmp->dm_symchains = malloc(sizeof (dt_sym_t) * dmp->dm_nsymelems + 1); + dmp->dm_symbuckets = calloc(dmp->dm_nsymbuckets, sizeof (uint_t)); + dmp->dm_symchains = calloc(dmp->dm_nsymelems + 1, sizeof (dt_sym_t)); if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) { dt_module_unload(dtp, dmp); return (dt_set_errno(dtp, EDT_NOMEM)); } - bzero(dmp->dm_symbuckets, sizeof (uint_t) * dmp->dm_nsymbuckets); - bzero(dmp->dm_symchains, sizeof (dt_sym_t) * dmp->dm_nsymelems + 1); - /* * Iterate over the symbol table data buffer and insert each symbol * name into the name hash if the name and type are valid. Then diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c index 0c747ed133ca..a630d300dc50 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c @@ -27,6 +27,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2016 Pedro Giffuni. All rights reserved. */ #include <sys/types.h> @@ -47,15 +48,15 @@ dt_regset_create(ulong_t nregs) if (drp == NULL) return (NULL); - drp->dr_bitmap = malloc(sizeof (ulong_t) * n); - drp->dr_size = nregs; + drp->dr_bitmap = calloc(n, sizeof (ulong_t)); if (drp->dr_bitmap == NULL) { dt_regset_destroy(drp); return (NULL); } - bzero(drp->dr_bitmap, sizeof (ulong_t) * n); + drp->dr_size = nregs; + return (drp); } diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c index cf6bc48341db..21669c84aefc 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c @@ -24,6 +24,10 @@ * Use is subject to license terms. */ +/* + * Portions Copyright 2016 Pedro Giffuni. All rights reserved. + */ + #pragma ident "%Z%%M% %I% %E% SMI" #include <sys/types.h> @@ -70,12 +74,11 @@ dt_strtab_create(size_t bufsz) return (NULL); bzero(sp, sizeof (dt_strtab_t)); - sp->str_hash = malloc(nbuckets * sizeof (dt_strhash_t *)); + sp->str_hash = calloc(nbuckets, sizeof (dt_strhash_t *)); if (sp->str_hash == NULL) goto err; - bzero(sp->str_hash, nbuckets * sizeof (dt_strhash_t *)); sp->str_hashsz = nbuckets; sp->str_bufs = NULL; sp->str_ptr = NULL; |