[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH for 2.10 03/35] thunk: check nb_fields is vali
From: |
Eric Blake |
Subject: |
Re: [Qemu-trivial] [PATCH for 2.10 03/35] thunk: check nb_fields is valid before continuing |
Date: |
Mon, 24 Jul 2017 13:37:49 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/24/2017 01:27 PM, Philippe Mathieu-Daudé wrote:
> thunk.c:91:32: warning: Call to 'malloc' has an allocation size of 0 bytes
> se->field_offsets[i] = malloc(nb_fields * sizeof(int));
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> thunk.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Better would be fixing the code to use g_new0, and the corresponding free.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-trivial] [PATCH for 2.10 00/35] fix bugs reported by Clang Static Analyzer, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 01/35] tests: add missing dependency to build QTEST_QEMU_BINARY, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 02/35] loader: check get_image_size() return value, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 03/35] thunk: check nb_fields is valid before continuing, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 05/35] nbd: fix memory leak in nbd_opt_go(), Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 06/35] qcow2: remove inconsistent check, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-trivial] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24