xenmon: initialise dummy array

This is just used to expand the shared backing file to the expected
size (whether this is actually necessary I'm not sure). Rather than
leaking some small amount of the processes' heap set the array to
zeroes.

While at it add a check that the malloc succeeded before using the
result.

Compile tested only.

CID: 1056095 (use of uninitialised data)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Ian Campbell committed 2016-02-11 15:12:18 +00:00
1 parent 6d53f40fe1
commit 8b00908c11
1 file changed
+5
+5
View File
@@ -663,6 +663,11 @@ static void alloc_qos_data(int ncpu)
}
pgsize = getpagesize();
dummy = malloc(pgsize);
if (!dummy) {
PERROR("malloc");
exit(EXIT_FAILURE);
}
memset(dummy, 0, pgsize);
for (n=0; n<ncpu; n++) {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.