aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-05-03 15:29:13 +0200
committerGerd Hoffmann <kraxel@redhat.com>2021-05-04 08:38:40 +0200
commit06aa50c06c6392084244f8169d34b8e2d9c43ef2 (patch)
tree071fabc035edca5e185ca5e6cf5498d9ffdcba88
parent7ec54f9eb62b5d177e30eb8b1cad795a5f8d8986 (diff)
downloadqemu-06aa50c06c6392084244f8169d34b8e2d9c43ef2.zip
qemu-06aa50c06c6392084244f8169d34b8e2d9c43ef2.tar.gz
qemu-06aa50c06c6392084244f8169d34b8e2d9c43ef2.tar.bz2
usb/mtp: avoid dynamic stack allocation
Use autofree heap allocation instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210503132915.2335822-4-kraxel@redhat.com>
-rw-r--r--hw/usb/dev-mtp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index bbb8274..2a895a7 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -907,7 +907,8 @@ static MTPData *usb_mtp_get_object_handles(MTPState *s, MTPControl *c,
MTPObject *o)
{
MTPData *d = usb_mtp_data_alloc(c);
- uint32_t i = 0, handles[o->nchildren];
+ uint32_t i = 0;
+ g_autofree uint32_t *handles = g_new(uint32_t, o->nchildren);
MTPObject *iter;
trace_usb_mtp_op_get_object_handles(s->dev.addr, o->handle, o->path);