This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb/ada-lang.c: one malloc -> unique_ptr<[]>


*** TEST RESULTS FOR COMMIT 200069c74f42ffcc726b9995a46971a86286a256 ***

Author: Pedro Alves <palves@redhat.com>
Branch: master
Commit: 200069c74f42ffcc726b9995a46971a86286a256

gdb/ada-lang.c: one malloc -> unique_ptr<[]>

Switching gdb to use gnulib's C++ namespace mode reveals we're calling
malloc instead of xmalloc here:

 ..../src/gdb/ada-lang.c: In function value* ada_value_primitive_packed_val(value*, const gdb_byte*, long int, int, int, type*):
 ..../src/gdb/ada-lang.c:2592:50: error: call to malloc declared with attribute warning: The symbol ::malloc refers to the system function. Use gnulib::malloc instead. [-Werror]
	staging = (gdb_byte *) malloc (staging_len);
						   ^

We're unconditionaly using the result afterwards -- so it's not a case
of gracefully handling huge allocations.

Since we want to get rid of all cleanups, fix this by switching to
new[] and unique_ptr<[]> instead, while at it.

Regtested on Fedora 23.

gdb/ChangeLog:
2016-11-16  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_value_primitive_packed_val): Use unique_ptr and
	new gdb_byte[] instead of malloc and cleanups.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]