]> git.pld-linux.org Git - packages/qemu.git/blame - libvfio-user-alloca.patch
BR: bison flex libstdc++-static
[packages/qemu.git] / libvfio-user-alloca.patch
CommitLineData
d155a8f0
JB
1--- qemu-7.2.10/subprojects/libvfio-user/samples/client.c.orig 2024-04-04 06:27:19.254657097 +0200
2+++ qemu-7.2.10/subprojects/libvfio-user/samples/client.c 2024-04-04 16:55:35.883734463 +0200
3@@ -310,7 +310,10 @@ get_device_region_info(int sock, uint32_
4 size_t nr_fds = ARRAY_SIZE(fds);
5
6
7- region_info = alloca(size);
8+ region_info = malloc(size);
9+ if (region_info == NULL) {
10+ err(EXIT_FAILURE, "%m\n");
11+ }
12 memset(region_info, 0, size);
13 region_info->argsz = size;
14 region_info->index = index;
15@@ -318,7 +321,11 @@ get_device_region_info(int sock, uint32_
16 do_get_device_region_info(sock, region_info, NULL, 0);
17 if (region_info->argsz > size) {
18 size = region_info->argsz;
19- region_info = alloca(size);
20+ free(region_info);
21+ region_info = malloc(size);
22+ if (region_info == NULL) {
23+ err(EXIT_FAILURE, "%m\n");
24+ }
25 memset(region_info, 0, size);
26 region_info->argsz = size;
27 region_info->index = index;
28@@ -344,6 +351,7 @@ get_device_region_info(int sock, uint32_
29 }
30 }
31 }
32+ free(region_info);
33 }
34
35 static void
This page took 0.156622 seconds and 4 git commands to generate.