gdb/ada-lang.c: one malloc -> unique_ptr<[]>
authorPedro Alves <palves@redhat.com>
Wed, 16 Nov 2016 11:38:49 +0000 (11:38 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 17 Nov 2016 00:59:43 +0000 (00:59 +0000)
commit200069c74f42ffcc726b9995a46971a86286a256
tree00be16a40f21dbbc6e2e196dd33c4ec647af9206
parent19f1935d91bfabbe4176ffdaca95bc789b593153
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.
gdb/ChangeLog
gdb/ada-lang.c
This page took 0.037421 seconds and 4 git commands to generate.