summaryrefslogtreecommitdiff
path: root/hw/xquartz
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-01 11:04:07 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-12 23:12:48 -0800
commit3bc608a361a01043b226fb9aaebf88f6fd852925 (patch)
tree0259df845ac3b97e98030a3bd0ba675504f19176 /hw/xquartz
parent64327226ddfba8f0653615cd678d2d4336fb993d (diff)
XQuartz: Check for allocated memory before using it in AppleWMSetWindowMenu
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Diffstat (limited to 'hw/xquartz')
-rw-r--r--hw/xquartz/applewm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 4409d4bf6..9ff0ff650 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -378,6 +378,13 @@ ProcAppleWMSetWindowMenu(register ClientPtr client)
items = malloc(sizeof(char *) * nitems);
shortcuts = malloc(sizeof(char) * nitems);
+ if (!items || !shortcuts) {
+ free(items);
+ free(shortcuts);
+
+ return BadAlloc;
+ }
+
max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq);
bytes = (char *)&stuff[1];