From 18918978ba5c0f91f05513170c8ca57a93e96722 Mon Sep 17 00:00:00 2001 From: AndyZhou Date: Mon, 13 Dec 2021 11:41:25 +0800 Subject: [PATCH] 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 Change-Id: Idc2e3fd6be823c063a84868ba37b26ffe90db6fc --- clients/screenshooter.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.16.6