summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndyZhou <zhoumy@cn.fujitsu.com>2021-12-13 11:41:25 +0800
committerZhou Mingying <zhoumy@cn.fujitsu.com>2021-12-21 05:46:23 +0000
commit18918978ba5c0f91f05513170c8ca57a93e96722 (patch)
tree72bc0170014508fd1c2b269788a5f03ab0b01a6d
parent6371b14eb0abbb2398453919b024b088a15c6f6d (diff)
agl-compositor:Add NULL check after zalloc in screenshooter.c
There's no NULL check in zalloc. xdg_output is alloced by zalloc. Add a NULL check after zalloc and before use xdg_output. Bug-AGL: SPEC-4178 Signed-off-by: ZhouMingying <zhoumy@cn.fujitsu.com> Change-Id: Idc2e3fd6be823c063a84868ba37b26ffe90db6fc
-rw-r--r--clients/screenshooter.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/clients/screenshooter.c b/clients/screenshooter.c
index 64dc76a..8c2b553 100644
--- a/clients/screenshooter.c
+++ b/clients/screenshooter.c
@@ -201,6 +201,8 @@ add_xdg_output_v1_info(struct screenshooter_data *shooter_data,
struct screenshooter_output *output)
{
struct xdg_output_v1_info *xdg_output = zalloc(sizeof(*xdg_output));
+ if (!xdg_output)
+ return;
wl_list_insert(&shooter_data->xdg_output_list, &xdg_output->link);