binutils-gdb/libctf
Nick Alcock de07e349be libctf: remove ctf_malloc, ctf_free and ctf_strdup
These just get in the way of auditing for erroneous usage of strdup and
add a huge irregular surface of "ctf_malloc or malloc? ctf_free or free?
ctf_strdup or strdup?"

ctf_malloc and ctf_free usage has not reliably matched up for many
years, if ever, making the whole game pointless.

Go back to malloc, free, and strdup like everyone else: while we're at
it, fix a bunch of places where we weren't properly checking for OOM.
This changes the interface of ctf_cuname_set and ctf_parent_name_set,
which could strdup but could not return errors (like ENOMEM).

New in v4.

include/
	* ctf-api.h (ctf_cuname_set): Can now fail, returning int.
	(ctf_parent_name_set): Likewise.
libctf/
	* ctf-impl.h (ctf_alloc): Remove.
	(ctf_free): Likewise.
	(ctf_strdup): Likewise.
	* ctf-subr.c (ctf_alloc): Remove.
	(ctf_free): Likewise.
	* ctf-util.c (ctf_strdup): Remove.

	* ctf-create.c (ctf_serialize): Use malloc, not ctf_alloc; free, not
	ctf_free; strdup, not ctf_strdup.
	(ctf_dtd_delete): Likewise.
	(ctf_dvd_delete): Likewise.
	(ctf_add_generic): Likewise.
	(ctf_add_function): Likewise.
	(ctf_add_enumerator): Likewise.
	(ctf_add_member_offset): Likewise.
	(ctf_add_variable): Likewise.
	(membadd): Likewise.
	(ctf_compress_write): Likewise.
	(ctf_write_mem): Likewise.
	* ctf-decl.c (ctf_decl_push): Likewise.
	(ctf_decl_fini): Likewise.
	(ctf_decl_sprintf): Likewise.  Check for OOM.
	* ctf-dump.c (ctf_dump_append): Use malloc, not ctf_alloc; free, not
	ctf_free; strdup, not ctf_strdup.
	(ctf_dump_free): Likewise.
	(ctf_dump): Likewise.
	* ctf-open.c (upgrade_types_v1): Likewise.
	(init_types): Likewise.
	(ctf_file_close): Likewise.
	(ctf_bufopen_internal): Likewise.  Check for OOM.
	(ctf_parent_name_set): Likewise: report the OOM to the caller.
	(ctf_cuname_set): Likewise.
	(ctf_import): Likewise.
	* ctf-string.c (ctf_str_purge_atom_refs): Use malloc, not ctf_alloc;
	free, not ctf_free; strdup, not ctf_strdup.
	(ctf_str_free_atom): Likewise.
	(ctf_str_create_atoms): Likewise.
	(ctf_str_add_ref_internal): Likewise.
	(ctf_str_remove_ref): Likewise.
	(ctf_str_write_strtab): Likewise.
2019-10-03 17:04:56 +01:00
..
ChangeLog libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
Makefile.am libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
Makefile.in libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
aclocal.m4 libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
config.h.in libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
configure libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
configure.ac libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
ctf-archive.c libctf: avoid the need to ever use ctf_update 2019-10-03 17:04:56 +01:00
ctf-create.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-decl.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-decls.h libctf: avoid strndup 2019-06-07 13:46:39 +01:00
ctf-dump.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-endian.h libctf: make it compile for old glibc 2019-10-03 17:04:55 +01:00
ctf-error.c libctf: handle nonrepresentable types at link time 2019-10-03 17:04:56 +01:00
ctf-hash.c libctf: don't leak hash keys or values on value replacement 2019-10-03 17:04:55 +01:00
ctf-impl.h libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-labels.c libctf: fix a number of build problems found on Solaris and NetBSD 2019-05-31 11:10:51 +02:00
ctf-link.c libctf: avoid the need to ever use ctf_update 2019-10-03 17:04:56 +01:00
ctf-lookup.c libctf: avoid the need to ever use ctf_update 2019-10-03 17:04:56 +01:00
ctf-open-bfd.c libctf: actually close bfds we have opened 2019-10-03 17:04:55 +01:00
ctf-open.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-qsort_r.c libctf: look for BSD versus GNU qsort_r signatures 2019-06-04 17:05:08 +01:00
ctf-string.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-subr.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-types.c libctf: get the encoding of non-ints/fps in the dynamic space right 2019-10-03 17:04:56 +01:00
ctf-util.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
elf.h libctf: low-level list manipulation and helper utilities 2019-05-28 17:07:19 +01:00
libctf.ver libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
swap.h libctf: fix a number of build problems found on Solaris and NetBSD 2019-05-31 11:10:51 +02:00